Robocopy parameters?

mlcktmguy used Ask the Experts™
About a month ago my scheduled batch backup using xcopy began to fail.  I posted a question about the issue on EE and eventually scrapped the xcopy  with a new backup using Robocopy

Old xcopy Backup
xcopy "I:\My Documents\*.*" "K:\Mike\" /s /y /f

Open in new window

Robocopy backup
set LogFile=I:\My Documents\copylog.txt
RoboCopy "I:\My Documents" "K:\RoboCopy" /E /TEE /LOG+:"RoboCopyLog.txt"

The xcopy retained files on the destination that had been removed from the source and I set up the new Robcopy to do the same.

Now the xcopy backup contains files that aren’t in the new Robocopy backup.  These would be files that had been removed from the source drive over time.

The source directory for both backups is I:\My Documents.  There are many subdirectories under this main directory.
I would like to set up a onetime Robocopy that will copy from K:\Mike to K:\Robocopy.  However, the only files (and possibly directories I want to copy are the ones that don’t exist in K:\Robocopy.

What parameters do I use on the onetime RoboCopy to accomplish this?
RoboCopy "K:\Mike" "K:\RoboCopy"  /?????
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
IT / Software Engineering Consultant
Top Expert 2016
I believe you can do:

robocopy /e /xc /xn /xo source destination

Open in new window

Most Valuable Expert 2013

You have to be a bit creative with the switches to do this & RC users often ask for this to be a single switch

This should do it:

 X:\SourceFolder Y:\DestinationFolder /E /XC /XN /XO

It's really a recursive copy excluding anything that matches the destination - there's one caveat which is if you have same filename but different version in the same location on the destination RC will not overwrite it.

EDIT ... What Bill said above :)


Bill PrewIT / Software Engineering Consultant
Top Expert 2016



Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial