title: Reorganize files in HDFS
body: <p>I need to move files written by a Hive job that look like this</p>
  
  <pre><code>/foo/0000_0
  /foo/0000_1
  /bar/0000_0
  </code></pre>
  
  <p>into a file structure that looks like this</p>
  
  <pre><code>/foo/prefix1/prefix2-0000_0
  /foo/prefix1/prefix2-0000_1
  /bar/prefix1/prefix2-0000_0
  </code></pre>
  
  <p>before migrating this out of the cluster (using s3distcp). I've been looking around hadoop fs but I can't find something that would let me do this. I don't want to rename file by file.</p>