Robocopy and the XX Argument (Exclude Extra)

Microsoft Windows
Post Reply
User avatar
MigrationUser
Posts: 336
Joined: 2021-Jul-12, 1:37 pm
Contact:

Robocopy and the XX Argument (Exclude Extra)

Post by MigrationUser »

baptea 01 Dec 2011 19:54

Hey, I just wanted to clarify the behaviour of the /XX argument provided by Robocopy.

The documentation on ss64.org currently reads:
An "extra" file is present in destination but not source,
excluding extras will delete from destination.
SRC: https://ss64.com/nt/robocopy.html

The documentation on TechNet reads:
Excludes extra files and directories.
SRC: https://docs.microsoft.com/en-us/window ... s/robocopy

My reading of the ss64 page suggests that Robocopy will delete any extra files in the destination (that aren't in the source). However, the TechNet page doesn't mention that. Can anyone clarify if /XX will ever delete files in the destination?

If it does sometimes delete files, what's the difference between that and /Purge?

Many Thanks
----------------------------
#2 01 Dec 2011 22:16

Simon Sheppard

I think you are right, it looks to me like the wording should be
An "extra" file is present in destination but not source,
excluding extras will NOT delete from destination.
But I just ran a couple of tests which is the only way to prove these things:

robocopy source dest /XL
works as you would expect, any new files in the source don't get copied

robocopy source dest /XX
Does not delete any "extra" files from the destination

but then neither does a simple
robocopy source dest

Perhaps the /XX switch only takes effect when mixed with other switches:

robocopy source dest /purge
Will delete "extra" files from the destination

robocopy source dest /purge /XX
Will NOT delete "extra" files from the destination, in other words the /XX switch just turns off the effect of /Purge and returns us to the default behaviour.

In a similar vein
robocopy source dest /S /mir /XX
Will copy new files and folders and will not delete "extra" files from the destination.
Which I think is just the same as
robocopy source dest /E

So based on all that I think the correct help text should be:
An "extra" file is present in destination but not source,
excluding extras will not delete files from the destination (this is the default).
----------------------------

#3 02 Dec 2011 10:01
baptea

Thanks for the quick reply Simon. Excellent Website!

----------------------------

#4 27 Feb 2021 18:18
rLap

I was just wondering about /xx too, and I found a difference:

/xx will SUPPRESS showing extra destination files in the log

example
source:
aa
bb

destinationdir
aa
bb
cc

then without /xx you log will look something like below

Code: Select all

Optionen: *.* /FFT /NDL /TEE /S /DCOPY:DA /COPY:DAT /NP /XO /R:1 /W:0

------------------------------------------------------------------------------

          *EXTRA Datei               834        e:\cc                                              <---  file cc
----------------------------

#5 27 Feb 2021 23:32
Simon Sheppard

Nice find rLap, I just added a line to the SS64 robocopy page about that.

----------------------------

#6 28 Feb 2021 02:30
Shadow Thief

If /XX says to ignore extra files, then it makes sense that extra files won't show up in the log
Post Reply