Sign in with
Sign up | Sign in
Your question

Batch file needed to combine all subdirectories to one

Tags:
  • Programming
  • Apps
Last response: in Apps General Discussion
Share
January 3, 2013 2:42:42 AM

I am need of help and saw some good ones on here but not specific to what i need to acomplish. I have a folder on my D:\ drive (clients) that contains around 3,000 or so other folders (client names). in those folders the files and folders can be completely random.

i am trying to create a batch file to take all of the subfolders and files that are in the individual client names folders and combine them all into one new folder within the client names folders.

Any help out there? i havn't done much with bat files other than for reporting file types of these same folders and also mapping network drives.

thanks,
J

More about : batch file needed combine subdirectories

January 19, 2013 1:43:19 PM

Funnily enough because of a very old annoyance with PKZIP and PKUNZIP you can do just this.

Use PKZIP to ZIP each folder, inclusive of everything to a given location.
Then use PKUNZIP to extract the contents of the ZIP --- without preserving the folder (directory and sub-directory) hierarchy.

So long as you have the free space for each ZIP that gets created this is by far the easiest solution, as batch files don't really handle unknown folder names without some really funky capturing of those names and processing them using methods that, frankly, are more dangerous (by far) than what I've proposed.

!