Robocopy switch question about /xn and /xo

patriots used Ask the Experts™
We use robocopy to sync files back and forth between two file servers running on different operating systems.  The robocopy options I'm using are:
/E /XO /XN /X /R:1 /W:10

So, the /xo and /xn switches are supposed to exclude "old" files and "new" files, however in the output , I still see files being copied that are showing as "new file".  My hope is that these files are actually "changed" files (since the exclude change switch is not being used here).  Can anyone confirm this?

What we're trying to accomplish is a copy in which only new or updated files/folders are copied and no others.  This is highly critical as the target file server is being used by several hundred people and the last thing we want to do is make a mistake in our switches causing some files or parts of files to be overwritten by anything other than a file that is updated or a completely new file.  Thank you.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Q: How would Robocopy confirm whether it is a changed file or not without checking the contents? Checking the date stamp only is a little feeble.

If it reads the contents, then your performance may tank regardless of the switches. If it doesn't, then it will fail to copy some changed files.


Good question.  I don't know the inner-workings of how Robocopy does it's analysis in order to copy files, which is one reason why I have my question posted here.  In my view, date stamps are unreliable b/c it seems they can be changed at times by simply moving files around whether or not the file has actually been changed or not.
Distinguished Expert 2017
Presumably, you want the data on each fileserver to be the same (mirrored) without the delete just in case?

The /XN and /XO deal with newer and older files.
Have not used those options, but it seems that if there is file1 on servera and file1 on serverb if one of them is newer and one of them is older, they will be excluded from copying accross.

TRY runing your command with the /L flag at the end with the output going into a file.
Then remove one of the switches and run the command with the /L flag again with the output into a file.
repeat for removing the other /X with the /L flag and write it into the file.

This way you have a step be step what those two flags affect.

A file that is moved is a new file in the new location.

You could get rsync for windows or deltacopy.
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

At least robocopy can maintain datestamps using (overkill) /COPYALL /DCOPY:T. But the observation stands that whichever way it does the check, it seems inadequate. Either the server load is high (if it is thorough) or the result is faulty (if it is quick).

You could test the result using a product like BeyondCompare (free trial) to see if a file with changed contents still copies over, or simply to compare the BC 'changed' list with what robocopy copies.

You could also use FileMon to see if robocopy is reading the contents of the files.

Even if the documentation says otherwise, I'd still check this if it was important as MS says that the implementation is always definitive, regardless of the documentation.


To clarify further, and not sure that this makes a difference or not, but Server A is Netware 6.5 while Server B is Server 2008 R264.  For several months now we have been doing a one-way sync from the Netware to the Windows side.  Now we need to periodically go in reverse from the Windows to the Netware side.  You would think that the switches we used from Netware to Windows should work in reverse, however, it appears that it is treating every file as new and copying every file when this sync is reversed.  All I can figure is that between the two platforms, Robocopy doesn't know what to do, so it's interpreting every file as a new file whether it is or not.  In theory, this should be no problem.  It will take awhile to complete the copy, which is 750GB, but the end result will be that any update on the Windows Server should eventually show up on the Netware server.  However, it's kind of nerve racking to see that it's overwriting every file.

The purpose of this sync is the fact that we are in the middle of a migration, and for awhile at least, we are going to have two sets of people--One running on the Netware and the other on Windows.  (Instead of synchronizing Novell and Windows accounts we elected to simply synchronize the file servers--it's a long story.)
Distinguished Expert 2017

In this case, I think the problem might be the file attributes that get changed.

Have a look at deltcopy to see whether it is better at performing what you need.

You have the /X flag which would report an event event if it does not really copy a file.
This might what you are seeing i.e. filea while is new but is not being copied.

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