title: Batch file to rename folders with wildcard or create a new folder and move contents?
body: <p>I'm trying to tidy up a data folder and have written a batch file to take care of a lot of preliminary work (delete empty folders, delete junk files, etc), but I'm falling over when trying to deal with files within duplicate folders.</p>
  
  <p>This is an example of the current situation:</p>
  
  <pre><code>w:\Data\Corporations\555\20130101\Concat_000001\555_20130101_data.zip
  w:\Data\Corporations\555\20130101\Concat_000002\555_20130101_data.zip
  w:\Data\Corporations\555\20130101\Concat_000003\555_20130101_data.zip
  w:\Data\Corporations\555\20130101\Concat_000004\555_20130101_data.zip
  </code></pre>
  
  <p>There should only be one Concat folder per YYYYMMDD folder, and should look like this:</p>
  
  <pre><code>w:\Data\Corporations\555\20130101\Concat\555_20130101_data.zip
  </code></pre>
  
  <p>There are hundreds of folders in w:\Data\Corporations to be processed, so I figure I need to first of all find any folder named Concat_*, make a folder named Concat within the same parent folder, and then move any <em>zip from Concat_</em> to Concat.</p>
  
  <p>I have tried various combinations of <code>FOR /D in (Concat_*)</code> with <code>MD</code> and <code>MOVE</code> commands, but with no luck so far. I've also tried calling a subroutine from the <code>FOR</code> statement that would jump back a level in the tree, create a folder named Concat, go back to Concat_* and move the .zip files, but again with no luck.</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Cheers,</p>
  
  <p>Pete</p>