Saturday, October 01, 2011

 

Windows 7: Fast and Flexible File Copy with RoboCopy

Did you know that RoboCopy is included with all editions of Windows 7? I didn’t until very recently, when a colleague (Mike Minutillo) mentioned it.

Robocopy (short for Robust File Copy) can do so much more than the standard Copy and Xcopy commands.

The basic syntax is as follows:

robocopy source destination [file [file]...] [options]

The source and destination parameters are specified as drive:\path or \\server\share\path. The file parameter can contain one or more literal file names, or it can use ? and * wildcards.

For instance, this command copies the contents of one folder and all its subfolders from a local drive E to a shared folder:

robocopy "E:\test" \\server\public\test\ /MIR /W:30 /R:10 /MT:8 /LOG:\\server\public\logs

The /MIR switch mirrors the two folders, copying all folders (even empty ones) from the source directory and removing folders from the destination if they no longer exist on the source. The /W and /R switches set the wait and retry options; in this case, Robocopy will retry each copy up to 10 times, waiting 30 seconds between attempts. The /MT[:n] switch performs a multi-threaded copy, where n indicates the number of threads to be used (n is 8, by default) and can range from 1 to 128. The /LOG: switch logs output to the specified location.

To see the full list of options, type robocopy /? at a command prompt.

There’s even a GUI!



    

Powered by Blogger