Tag: Copy directory

Robocopy: How to copy files to a another drive, or server – only if they have changed?

With the robocopy, we can use the below syntax to copy everything from “x:\source” to “\\server\x\dest” including sub-directories:

robocopy x:\source \\server\x\dest /e /r:0 /w:0

Robocopy will look for the date and time stamp of each file. If the file has not changed, it will skip it.

Usage of parameters is as follows:

/e – This will include sub-folders, even if empty

/r:0 – Retry on failure zero times. No retries in this example. It will keep restarting the copy on failure

/w:0 – The number of seconds to wait between failures

Above won’t do is delete files on the destination if they have been deleted on the source. This can be attained by using /purge option:

robocopy X:\source \\server\X\dest /e /r:0 /w:0 /purge

Note: Usage of /purge will delete files on the destination. If you have an empty directory in source, you will end up with an empty directory on the destination.

-WintelAdmin

Filed under: Storage (EMC/NetApp), Windows(2003/2008/2012)Tagged with: , , , , , , ,