41

Is it possible to use robocopy to copy only the files that do not exist in destination?

robocopy has a /is (include same files) switch. What I am looking for is an /xs switch. If a file exists in both the source and the destination I don't want it to be copied. The criteria is file name only, regardless of modified day, size, etc. For example, even if the source has a newer file (based on modified date) than the same file in the destination, I don't want it to be copied. Possible to do this? Thanks.

Oliver Salzburg
  • 89,072
  • 65
  • 269
  • 311
yky
  • 411

2 Answers2

50

Just use the /xc (exclude changed) /xn (exclude newer) and /xo (exclude older) flags:

robocopy /xc /xn /xo source destination 
Harry Johnston
  • 5,914
  • 8
  • 34
  • 58
-1

If you're copying from left to right, you want to only copy orphaned files on the left to the right side.

I use a pay tool called Beyond Compare that handles these type of scenarios. RoboCopy is great for mapped drives or even UNC paths, but my two use cases involves:

  • FTP to copy new files to my web site
  • move/archive files to DropBox

That, I unfortunately can not do with RoboCopy.

Sun
  • 6,480