Merge A Level Of Folders Into One

December 25, 2011 at 19:39:41
Specs: Windows XP, No Matter
Ok. I have a huge list of folders. These are good, and will be referred to as the base folders.
In these base folders there is another folder which is labeled archive (yes in every folder).
Inside of the archive folder there is any number of folders. These folders contain only files, no folders so no recursive work here. But want to merge the last level of files and move it up two levels.
Basic Setup:
BASE FOLDERS>archive>(a b c .. folders)>FILES
I need to turn it into

I would like a batch file in the root folder (with BASE folders in it) that would go into each base folder and move all the files to the base folder.

See More: Merge A Level Of Folders Into One

Report •

December 26, 2011 at 13:54:29
Solved it. I was missing a set of quotes and forgot about the double percent (%%) when expanding the variable.
Here it is if anyone is interested:
FOR /R %%I IN (*.*) DO MOVE "%%I" "%%~dpI..\.."

/R Makes it recursive (all files inside any folder in the root directory)
*.* Specifies which files to move
%%~dpI is the original folder of the file
..\.. Tells the files to move two levels up. if you add another \.. it moves a third level.

Good Hunting

Report •
Related Solutions

Ask Question