Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a built-in way (WIN7) or third-party utility I can use that will allow me to move the contents of the subfolders of my hundreds of parent folders up one level?

To illustrate:


What I want to do (at a single batch action, not individual per folder) is:


Parents have varying names, but all subfolders have the same name "gallery". Is there any quick and painless way to do this? I have roughly 650+ PARENT folders.

share|improve this question
Have you tried renaming tools, eg. AR? – Endoro May 25 '13 at 11:52
You could take the opportunity to learn Microsoft PowersHell. A winner in the Truth In Advertising category! – HABO May 25 '13 at 13:02
up vote 2 down vote accepted

You can have Windows execute the same command for all 650 folders sequentially with a simple for /D loop. Go to the directory containing the parents and execute the following command:

for /D %i in (.\*) do @move %i\gallery\* %i\

Optionally, you can delete the empty 'gallery' folders using `rmdir' without the /S-flag, e.g.:

for /D %i in (.\*) do @(move %i\gallery\* %i\ && rmdir %i\gallery)

For more control over the file operations, you may want to look into robocopy, which is far more advanced than move. Also note that spaces in directory names are often parsed as delimiters. For example, rmdir parent 1 will remove the directories 'parent' and '1', but not 'parent 1'. If your directories contain spaces, use quotes, e.g.:

for /D %i in (.\*) do @move "%i\gallery\*" "%i\"
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .