Let Robocopy save you time

Domo arigato, Mr. Robocopy?

Ok. I know that,s a bad play on words, but in today’s post I want to cover a tool that is often forgotten- Robocopy. Recently I needed to copy over 50,000 folders from an old file server that was getting decommissioned. On top of that, I needed to make sure all the correct folder permissions were applied. Instead of using a simple right click and paste over and over again, I turned to Robocopy.

This gem is tucked into the Microsoft Windows Server 2003 Resource Kit, and included in Server 2008. There is no need to download it. Unlike the “copy” command or “xcopy”, Robocopy is able to resume after a network outage. This feature is especially useful when you are working on an unstable network.

Robocopy is also able to correctly copy over file attributes, alternate streams, and security access control list (ACL). It can even skip files that already appear in the destination folder. How awesome is that!

A new feature that was release in Server 2008 is Multi-thread copying. You can now use the /MT[:n] switch, where n indicates the number of threads to be used. Default is set to 8, but you can set any value between 1 and 128. Setting this switch can dramatically speed up your copying. If you set it to a high number, you run the risk of crashing your server. Be careful. Start with a low number and work your way up. If you start seeing performance issues, lower the number back down.

Below are some examples on how to use this tool.

Syntax:

robocopy <Source> <Destination> [<File>[ ...]] [<Options>]

Examples:

Copy files from two different servers using Robocopy:

robocopy \ServerAsharename \ServerBSharename /E /Z /COPY:DATSOU /R:1 /LOG+:d:robocopy.log

/e – Copies subdirectories. Note that this option includes empty directories.
/z – Copies files in Restart mode.

/copy: – Specifies the file properties to be copied. The following are the valid values for this option:

  1. D Data
  2. A Attributes
  3. T Time stamps
  4. S NTFS access control list (ACL)
  5. O Owner information
  6. U Auditing information

/r:<n> – Specifies the number of retries on failed copies. The default value of N is 1,000,000 (one million retries).

Copy files to a different folder on the same server using Robocopy:

robocopy C:temp C:temp2 /E

/e – Copies subdirectories. Note that this option includes empty directories.

Here are some links to additional resources:

Robocopy GUI – http://technet.microsoft.com/en-us/magazine/2006.11.utilityspotlight.aspx
Robocopy Wiki – http://en.wikipedia.org/wiki/Robocopy
Perform Multithreaded File Copies with Robocopy – http://technet.microsoft.com/en-us/magazine/dd542631.aspx

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

Menu