Copyfiles from Directory Tree to Flat Folder - Keep most Recent
I am trying to create a batch file that will allow me to copy files that are scattered across several directories into a single location while maintaining the most recent copy available. This is for a Windows machine.
For example...
C:\Base Files\*.jpg
C:\Base Files\Sub\*.jpg
C:\Base Files\Sub2\*.jpg
and copy all of these to C:\Backup
.
I am trying to do something like the following...
FOR开发者_如何学CFILES /p "C:\Base Files\DIR01\My Images" /s /M *.JPG /c "copy @file C:\SANDBOX\DIR02"
But it dumps out each time right away with a "File not found" message.
Thanks in advance for your help!
Well, if we change "maintaining the most recent copy" by "copying only the modified files", then this command do that:
xcopy "C:\Base Files\*.*" C:\Backup /m /s
Regards...
This worked for me:
forfiles /s /p "C:\SourceFolder" /C "cmd /c copy @path C:\DestinationFolder"
精彩评论