Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Robocopy - Exclude Existing Files
robocopy c:\Sourcepath c:\Destpath /E /XC /XN /XO
:: /E makes Robocopy recursively copy subdirectories, including empty ones.
:: /XC excludes existing files with the same timestamp, but different file sizes. Robocopy normally overwrites those.
:: /XN excludes existing files newer than the copy in the source directory. Robocopy normally overwrites those.
:: /XO excludes existing files older than the copy in the source directory. Robocopy normally overwrites those.
:: With the Changed, Older, and Newer classes excluded, Robocopy will exclude files existing in the destination directory.
@kurinoku

This comment has been minimized.

Copy link

@kurinoku kurinoku commented Oct 4, 2017

thank you ~~

@rajadain

This comment has been minimized.

Copy link

@rajadain rajadain commented Mar 22, 2018

Super useful!

@jbhutchens

This comment has been minimized.

Copy link

@jbhutchens jbhutchens commented Apr 9, 2018

Well, that was a nice copy and paste. Thank you for posting it!

@oliva1337

This comment has been minimized.

Copy link

@oliva1337 oliva1337 commented Sep 14, 2018

amazing

@mpniel

This comment has been minimized.

Copy link

@mpniel mpniel commented Dec 26, 2018

Wouldn't it be simpler less stupid to have a special swith to exclude existing files instead of adding tree different ones to do the same job?

@JeffCave

This comment has been minimized.

Copy link

@JeffCave JeffCave commented Aug 14, 2019

@mpniel robocopy is a syncronization utility. That means that not copying files that are different would be strange. In that context, not comparing files at all is the weird edge case. The ability to turn off each type of difference check one at a time is the more useful scenario.

(I say that having come here looking for a way to turn off all the checks in one go)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment