Flexible File Copying with Robocopy

By Mark Castle on 25th March, 2011.

Simple File Copying

One of the handiest command line tools that we’ve come across in recent years is robocopy which has been built into the operating system since the advent of Vista.

It is a flexible file copying command which unlike other commands such as copy or xcopy can be used for both simple file copy actions to reliable mirroring of whole folders of any size. It can copy files, move files, copy only changed files, copy security attributes, NTFS permissions and owner information of files to name but a few of the options. It is pretty much the Windows equivalent of the well known rsync utility on Linux.

At Secura Hosting, we provide all managed dedicated server clients with an allocation of storage on our NAS storage network which is located across remote data centres. Many of our clients use the robocopy to schedule copies of their important data to this remote storage. One of the features that makes this tool great for backing up over the network is that you can specify retry attempts and retry interval periods for any interruptions in the copying process.

The following are some examples of how you can use robocopy:

Robocopy Example 1: Copy folder (including subfolders) from one server to another
robocopy \server1folder1 \server2folder1-backup /E

Robocopy Example 2: Mirror a complete folder (including subfolders) from one server to another, removing folders on the destination that no longer exist on the source
robocopy \server1folder1 \server2folder1-mirror /MIR

Robocopy Example 3: Move files over 7 days old to another server (locked files will be retried every 30 seconds a maximum of 3 times)
robocopy \server1folder1 \server2folder1-archive /move /minage:14 /r:3 /w:30

You can find the full command line reference by simply typing ‘robocopy /?’ (without the quotes) at a command prompt or by visiting here: http://technet.microsoft.com/en-us/library/cc733145(WS.10).aspx.

Mark Castle


Marks is a director at Secura hosting and one of our resident Network specialists.

Tweet me at:

Comments are closed.