Strip Files from Folders into Single Folder
Posted on 2008-06-15
I am trying to find a XCOPY or ROBOCOPY solution to Strip Files from a Folder Structure into a Single Folder.
Here follows an example.
Destination (with how I want my files):
The above requirement appeared so straight forward when I took it on, but I have not been able to find the right XCOPY or ROBOCOPY parameters to achieve this. I would expect the solution to be some way of using a wildcard foldername to translate C:\MYFOLDER\STRUCTURE\AFOLDER123\*.XLS to C:\MYFOLDER\<WILDCARD>\AFOLDER\*.XLS so I can achieve something like this:
XCOPY C:\MYFOLDER\STRUCTURE\*\*.XLS E:\MYFOLDER\STRUCTURE\
Unfortuntately you cannot use an asterisk to wildcard a foldername as above.
Please do not suggest using a recursive folder switch such as /S, because I can assure you that the following will not produce the required result:
XCOPY /S C:\MYFOLDER\STRUCTURE\ E:\MYFOLDER\STRUCTURE\
The structure from which we need to strip the files will be reproduced with the /S recursive switch.
Any assistance in this matter will be greatly appreciated.