Copy files with RoboCopy

Server Administration

Robocopy is a tool provided by Microsoft that provides a robust way to move files. It comes built in to Windows 7, Windows 8, Server 2008, Server 2008 R2, and Server 2012. It can also be downloaded for Server 2003. If you’ve ever had a problem with file names being too long or copy jobs getting stuck waiting for input using Windows Explorer, you’ll love Robocopy.

Copy Data *without* Attributes

If I just want to copy data from one place to another, and I don’t care about dates or file permissions being copied with the data, I’ll use the following command because it’s so easy to remember. The /e switch tells Robocopy to copy subdirectories even if they’re empty.

robocopy /e

Copy Data *with* Attributes

If I DO care about file permissions and other attributes being copied to the file destination, I use Robocopy with the following switches. I typically like using this if I am moving data from one file server to another.

robocopy /e /dcopy:t /copyall /r:1 /w:1 /v /tee /log:copylog.txt

Here is a breakdown of what the switches do:

  • /dcopy:t copies the directory time stamps.
  • /copyall copies all file information including NTFS permissions and owner information.
  • /r:1 specifies the number of times Robocopy will attempt to copy the file. In this case, it will try once.
  • /w:1 specifies how long Robocopy will wait between retries. In this case, it will wait one second before retrying.
  • /v shows verbose output when you run the Robocopy command.
  • /tee will cause Robocopy to write output to the console and to the log file.
  • /log:copylog.txt tells Robocopy to save the log to a file called copylog.txt.

Copy Data that has Changed


If you’ve already run Robocopy once and just want to copy new or changed data, simply add the /xo switch to the end of your Robocopy command.

For more information, check out the TechNet article.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s