29

I would like to copy files from one drive to another, but I only want to copy source files that are newer than the destination file. BUT, I also want to only copy source files that have been changed after a certain date.

I know I can use xcopy to do either one of these things, but I would like to do both at the same time.

So for example, I want to copy all source files dated on or after 3/1/2013, but in addition I only want the file copied if the source file is newer than the destination. So ideally I would like to do something like this:

xcopy c:\*.* e:\*.* /D:03-01-2013

combined with something like this:

xcopy c:\*.* e:\*.* /D

Can this be done with xcopy or Robocopy?

Oliver Salzburg
  • 89,072
  • 65
  • 269
  • 311
PaulStock
  • 453
  • 1
  • 6
  • 10

3 Answers3

26

This will probably get you what you want:

Robocopy c:\ e:\ *.* /MAXAGE:20130301 /XO /E

Add the /L command to this to see what it will do without it actually doing it first just to make sure.

Check here for more information on Robocopy's options.

Rabbid10
  • 446
2

Just use both options in the same command:

xcopy c:\*.* e:\*.* /D /D:03-01-2013

gets you what you want.

Malcolm
  • 293
1

In case someone wants to do the same without command line, the SyncToy tool does the job pretty well.

https://www.microsoft.com/en-us/download/confirmation.aspx?id=15155

velval
  • 463