I had gotten an external harddrive to backup my laptop, but now I needed a way to copy only changed files. For example, if I have 5GB of files to backup, but perhaps only 10-100MB of new files each time I do the backup, for performance reasons I only want to copy the new stuff. Initially I thought "oh well, I'll just write my own program to do this", but then I realize that this is such a common task that there has to be free stuff out there (principle: don't reinvent the wheel). Someone pointed me to Robocopy, which you can download for free, along with 50+ other tools, as part of the Windows Server 2003 Resource Kit Tools.
Robocopy, for "Robust File Copy Utility ", is a command line tool for copying files from one location to another. It has all the switched that you'd expect: only copy changed files, ignore hidden files, number of times to retry copy a file if there are errors (such as a process locks the file and you can't copy it). It's a convenient thing. I created a batch script to do my master backup:
|
I stored the target drive as an environmental variable, and then used the following options:
Switch | Purpose |
/S | Copy Subdirectories, but not empty ones. |
/R:2 | Number of Retries on failed copies: default 1 million. |
/W:10 | Wait time between retries: default is 30 seconds. |
/XA:H | Don't copy hidden files |
There's tons of other switches to configure.
It's quick, yet extremely helpful if your main hard drive crashes.
No comments:
Post a Comment