So I am not able to find a switch in Robocopy or xCopy that lets me copy files from the source to the destination, only if the date of the file is different. Regardless if that file is newer or older than the one in the destination.
Situation 1: It should skip any files in the destination that match the date in the source. But if there is a older file in the destination than in the source, it will copy that.
Situation 2: Further, if there is a newer file in the destination than the source, it will copy that one as well.
I see there is a switch to do the former but I don't see one for the second situation.
Unfortunately, the xCopy /d switch will not work in this case either. Does anyone have any ideas on how I can do this?
I would prefer the answer to be in batch programming but if it is in Powershell, vb.NET, or C#, that's okay too. Any advice will be welcome.
Thank you!
Mark
After a long time, I finally figured out the answer I was looking for yesterday. It is...
ROBOCOPY /XX /MIR YourSourceFolder YourDestinationFolder
It's a combination of both the /XX and /MIR switches with RoboCopy.
The /XX switch will not allow RoboCopy to touch any extra file that already exists in the folder.
Then, the /MIR switch will bring a mirror copy from the SourceFolder to the DestinationFolder. Date and times will match in both folders. Amazing!
My mistake before was that I was attempting to just find a single switch that would do this for me rather than combining available switches.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments