Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you don't want to write Java Code for this - I think using the command line HDFS API is your best bet: </p> <p><a href="http://hadoop.apache.org/docs/r0.20.0/hdfs_shell.html#mv" rel="noreferrer"><code>mv</code> in Hadoop</a></p> <p><code>hadoop fs -mv URI [URI …] &lt;dest&gt;</code> </p> <p>You can get the paths using a small one liner:</p> <pre><code>% hadoop fs -ls /user/foo/bar | awk '!/^d/ {print $8}' /user/foo/bar/blacklist /user/foo/bar/books-eng ... </code></pre> <p>the <code>awk</code> will remove directories from output..now you can put these files into a variable:</p> <pre><code>% files=$(hadoop fs -ls /user/foo/bar | awk '!/^d/ {print $8}') </code></pre> <p>and rename each file..</p> <pre><code>% for f in $files; do hadoop fs -mv $f $f.lzo; done </code></pre> <p>you can also use <code>awk</code> to filter the files for other criteria. This should remove files that match the regex <code>nolzo</code>. However it's untested. But this way you can write flexible filters.</p> <pre><code>% files=$(hadoop fs -ls /user/foo/bar | awk '!/^d|nolzo/ {print $8}' ) </code></pre> <p>test if it works with replacing the <code>hadoop</code> command with <code>echo</code>:</p> <pre><code>$ for f in $files; do echo $f $f.lzo; done </code></pre> <p>Edit: Updated examples to use <code>awk</code> instead of <code>sed</code> for more reliable output.</p> <p>The "right" way to do it is probably using the <a href="http://hadoop.apache.org/docs/current/api/org/apache/hadoop/fs/FileSystem.html" rel="noreferrer">HDFS Java API</a> .. However using the shell is probably faster and more flexible for most jobs. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload