Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hamdyaea/ace82dade3dd95f6a7294105a3afd5f9 to your computer and use it in GitHub Desktop.
Save hamdyaea/ace82dade3dd95f6a7294105a3afd5f9 to your computer and use it in GitHub Desktop.
Robocopy - Exclude Existing Files
:: Developer : Hamdy Abou El Anein
robocopy c:\Sourcepath c:\Destpath /E /S /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.
@hamdyaea
Copy link
Author

hamdyaea commented Jul 3, 2018

Work better without exclusion
:: Developer : Hamdy Abou El Anein
:: First run make a complete backup
:: Other runs create an incremental copy

:: Robocopy \192.168.1.9\prod E:\IncreBackup /XC /XN /XO /TEE /S /R:3 /W:3 /v /fp /log:C:\Users\13prod2095\Desktop\NAS_Backup\backup.log

Robocopy \192.168.1.9\prod E:\IncreBackup /TEE /S /R:3 /W:3 /v /fp /log:C:\Users\13prod2095\Desktop\NAS_Backup\backup.log

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