I have a directory with several subdirectories with files.
How can I copy all files in the subdirectories to a new location?
Edit: I do not want to copy the directories, just the files...
As this is still on XP, I chose the below solution:
for /D %S IN ("src\*.*") DO @COPY "%S\" "dest\"
Thanks!
If I understood you correctly you have a big directory tree and you want all the files inside it to be in one directory. If that's correct, then I can do it in two lines:
In a batch file vs. the command line change %f to %%f
The Xcopy command should help here.
Or if you don't want any of the files in SrcDir, just the sub directories, you can use XCOPY in conjunction with the FOR command:
robocopy "c:\source" "c:\destination" /E
Ok. With your edit that says you don't want the directory structure, i think you're going to want to use something like this:
If you want to keep the same folder structure on the other end, sounds as simple as XCOPY
Use /e instead of /s if you want empty directories copied too.