Meet Robocopy

If you remember the days of DOS, you know the difference between COPY and XCOPY. For those times when XCOPY won’t cut it, there’s ROBOCOPY, part of the Windows resource kit.If you just need to sync up two directories, Robocopy does it happily. Type ROBOCOPY source destination, and it will happily copy new and changed files over, while leaving identical files alone. This can save lots of time.

ROBOCOPY.DOC will give you lots of tips and ideas for using the program.

I have to do a lot of work over a WAN, and sometimes the network conditions are less than optimal, to put it politely. By that I mean sometimes I get nostalgic for the 9600 bps modem I had in high school, because it was faster and more reliable. Robocopy will detect errors and retry, which is a huge help in these conditions.

One thing I do frequently is copy single large files. The documentation file isn’t very clear on how you do this, and the syntax is tricky. Here’s how to copy a single file between two servers or directories:

ROBOCOPY source destination file(s)

Here’s a line I use a lot, to shoot out new virus definitions to my management servers:

ROBOCOPY . "\\servername\c$\program files\symantec\symantec antivirus" *.xdb

This is just a glorified copy command, but if any part of it fails, it will retry until it works.

In the past I’ve also used Robocopy to move file shares when upgrading file servers. I’ll create the share on the new server, copy everything over, and then, in off hours the night before the cutover date, use Robocopy to sync them up. Here’s an example:

robocopy \\oldserver\accounting \\newserver\accounting /MIR

Of course, since Windows has had DFS for 8 years now, you’re using DFS for everything now, right? Of course not. So for the times when you have to replace a fileserver and migrating to DFS isn’t an option for whatever reason, Robocopy is your fastest and easiest option for a cutover.

If you found this post informative or helpful, please share it!

One thought on “Meet Robocopy

  • August 20, 2007 at 7:50 am
    Permalink

    So Windows has a sorta "rsync" like file copy cmd. That’s cool 🙂

Comments are closed.