You are on page 1of 1

Robocopy Script Example Robocopy is a great tool for moving data around a network.

It's an extremely wel l proven tool with countless uses. So we accept "robust copy" as a very fitting name. It can be a little tricky to get a full understanding of all the features it has , so here is a quick breakdown of some of the common ones. : Windows Batch File SET src="D:\data" SET dest="\\backupserver\backup$" SET log="c:\path-to-robocopy-log-file.log" robocopy %src% %dest% /E /Z /SEC /MIR /R:1 /LOG:%log% RobocopyLogScanner.exe /s Firstly we use the windows "SET" command to neaten up th e script. SET simply applies a string to a variable which is called using the %% symbols. "echo %src%" will output "D:\Data". So we are copying from the src to the dest The "/E" switch means go ahead and copy all directories, including empty ones. The "/Z" switch tells it to copy files in "restartable" mode. "/SEC" is important if we want to keep NTFS permissions intact. (Recommended) "/MIR" mirrors the data on the destination - meaning if a file is removed or add ed on the source, the destination is made to look the same! "/R:x" tells Robocopy to retry failed files x number of times. We recommend usin g /R:1 for most situations. And finally "/LOG:" is fairly self-explanitory. It's the destination of the log file. This is the file that Robocopy Log Scanner needs to scan. And at the end we put the RobocopyLogScanner.exe executable, which will scan the file and email the results to you!

You might also like