Tip of the day: Robocopy is in Vista

What’s Robocopy? It’s a command-line utility that is part of the resource kit for earlier versions of Windows (so non-Vista users are not left out). It should be called “Sane copy”, because by and large it does the obvious thing, whereas most copy utilities do the non-obvious thing. For example, let’s say you have a directory full of files on your desktop PC, and you want to back them up to another drive. So far, nothing special. A few days later, you want to do the same thing again. Most copy utilities will start asking questions about whether you want to merge folders, overwrite files, and so on. Going through this file by file is impossibly tedious, so you’ll probably ask for the whole lot to be overwritten. Now your very smart computer churns away (if there is a lot to copy) replacing perfectly good existing files with new copies, for the sake of just a few files that have actually changed. What you really want is to copy only those files that have been changed or added.

Enter Robocopy. Open a command prompt and type:

robocopy c:\mysourcedir d:\mytargetdir /e

The /e switch asks for all subdirectories to be copied, even if they are empty. Robocopy will only copy the changed files, and gives you a report showing how many files were copied and how many were skipped.

There is one possible flaw in this arrangement. If you deleted a file from the source folder, then copy it over an existing backup, the target folder will still contain the old file. This might not be what you want, especially if you are a developer and this is source code. Old files hanging around are a bad idea. Robocopy has an answer for this too:

robocopy c:\mysourcedir d:\mytargetdir /mir

This switch asks for targetdir to be a mirror of sourcedir, which means files in the target which no longer exist in the source will be deleted. No fuss. Obviously this presumes that you want them deleted. Disclaimer: don’t blame me if this is not the case.

If you can’t hack the command line, there’s a Robocopy GUI you can download. Follow the link and download the UtilitySpotlight2006 exe at the top of the page. This is a geeky GUI but has some neat time-saving features.

For those with a lot of files to back up – like, say, a 300GB media library – Robocopy or an equivalent is a huge time-saver. It’s actually got a host of additional features that I haven’t mentioned here – why not type:

robocopy /?

and take a look.

Technorati tags: , , ,

6 thoughts on “Tip of the day: Robocopy is in Vista”

  1. I was delighted to find that Windows 7 includes a version of Robocopy with a switch to handle Daylight Savings Time transitions (/DST), as well as the old one to cope with copying from an NTFS file system to a NAS, whose timestamp granularity is the same as FAT – 2 seconds (/FFT). The only annoying thing is that the newer version of Robocopy doesn’t run on XP or on Windows Server 2003…

  2. Should also have said that the Windows 7 version of Robocopy is multithreaded – although I have seen comments that this feature in RichCopy causes very bad file fragmentation. (I can also record my disappointment with Richcopy, supposedly an advance on Robocopy, not coping with DST transitions nor with copying from NTFS to NAS. And that’s just a couple of its faults…!)

Comments are closed.