Robocopy is your friend

Published October 23, 2008
Advertisement
Here's a nice hint. Since I run a little engineering shop, I'm always on the lookout for little utilities that make our system more automated. And this time it turned out to be one already built into Windows.

Since I have a big terabyte NAS drive hooked up to the network and it's important to keep backups of things, I decided to mirror our most important documents from the engineering machines. And there are loads of free folder-mirroring solutions out there. But it turns out that there's one built into Vista (and is available pre-Vista if you have the "Windows Resource Kit" or you just dig around a bit).

It's a Microsoft command-line gizmo called "robocopy", and it's basically xcopy on steroids. It's got millions of options, but the most important thing it does over xcopy is that it'll only copy changed files like a standard disk-mirroring utility. That means that if I have 50 gig of mirrored folders but only three files have changed, it'll only copy over those three files.

So a little batch-writing and work with the standard Windows task-scheduler, and I have a full mirror of our documents. And it's been working just fine for a year now, so I'm happy about it. Actually I mirror the files to a different folder every night (civilgrrl-1/monday/documents, civilgrrl-1/tuesday/documents, etc) so I have a seven-day backup of all of our files.


One good hint. If you're copying files from NTFS to Linux (a distinct possibility as most NAS boxes are running Linux) then use the /FFS command-line switch. When I first tested the robocopy-backup, it was backing up a lot of files that hadn't changed between sessions. Turned out that NTFS's file timestamps were more finely-grained than whatever the NAS is using, and the timestamps weren't exactly the same (just really close). The /FFS switch assumes that timestamps up to 2 seconds apart are the same, which fixed the problem.
Next Entry New Lappy
0 likes 4 comments

Comments

MauMan
I use rsync for the same task. It's command-line is more complicated than xcopy or robocopy but is has three advantages that are useful for me:

1) It runs on Windows, Unix, Linux so I can have the same backup command for all machines
2) You don't have to have the remote drive mounted locally over the network
3) You can easily tunnel it using ssh so you can have a disk at a remote site (in my case friend's house) so you can easily make offsite backups the same way as you do onsite backups.
October 23, 2008 09:51 AM
MauMan
Just out of curiosity what does robocopy do for your purpose that xcopy /d/z/s/e does not? The timestamp trick?
October 23, 2008 09:54 AM
johnhattan
I haven't taken a look at command-line options in a while, but the timestamp trick and retries on dropped network connections (important when backing up over wifi) are two things.

And I'm just backing up to a network share with a fixed IP address, "\\192.168.1.200\whatever\backup"
October 23, 2008 12:45 PM
MauMan
Cool; the retry is a nice option. I usually use xcopy because of the easier syntax but there are times you need something heavier weight like robocopy. I wish unix had a similar mid-weight copy tool like xcopy.

I did not realize it came with Vista since I have it in my standard utils folder I put on every machine. I'm happy to see we can count on having it on a given Microsoft machine.
October 23, 2008 01:17 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement