Robocopy is a Microsoft tool that I only recently discovered.
It’s a bit like rsync, but very Windows-specific. Really,
robocopy is a smarter xcopy. You use it mostly like xcopy,
but it recognizes when the source file is the same as the target
file, and skips copying it.
For example, I’m working on web Appia,
which is in the directory c:\Appia on the webappia machine.
I also keep a local copy on my own machine. After I’m done with a
work session on webappia, I want to update my local copy.
But there are 3,663 files in 203 folders, totalling about 220MB
in that folder! (We put all the supporting software, such as
Apache and MySQL, in that directory tree, too.) A regular copy
command, or xcopy, or dragging a folder to make a copy, will take
a long time, especially when I’m home. Instead, I use the command:
robocopy \\webappia\c\Appia c:\Appia /E
This has the same end effect as a copy, xcopy, or file drag, but it’s
much faster, because it recognizes that almost all the files in the
source directory are already in the destination directory, with the
same contents.
Robocopy is easy to use, too, as evidenced by the general syntax of
the command:
-
robocopy Source Destination [File [File]..] [/S | /E] [/LEV:n]
[/Z] [/B] [/ZB] [/COPY:Copy_Flags] [/SEC] [/COPYALL] [/NOCOPY]
[/PURGE] [/MIR] [/MOV] [/MOVE] [/CREATE] [/FAT] [/FFT] [/256]
[/MON:n] [/MOT:m] [/A+:{R | A | S | H | N}]
[/A-:{R | A | S | H | N}] [/RH:hhmm-hhmm] [/PF] [/IPG:ms] [/A]
[/M] [/IA:{R | A | S | H | N | C | E}]
[/XA:{R | A | S | H | N | C | E}] [/XF ExFile [ExFile]..]
[/XD Directory [Directory]..] [{/XC|/XN|/XO}] [{/XX|/XL}]
[/IS] [/IT] [/MAX:bytes] [/MIN:bytes]
[/MAXAGE:{days | YYYYMMDD}] [/MINAGE:{days | YYYYMMDD}]
[/MAXLAD:{days | YYYYMMDD}] [/MINLAD:{days | YYYYMMDD}]
[/ITEM] [/IOFF] [/XJ] [/R:RetryNumber] [/W:WaitTime] [/REG] [/TBD]
[/L] [/X] [/V] [/TS] [/FP] [/NS] [/NC] [/NFL] [/NDL] [/NP] [/ETA]
[/LOG:file_name] [/LOG+:file_name] [/TEE] [/JOB:job_name]
[/SAVE:job_name] [/QUIT] [/NOSD] [/NODD] [/IF] [/SD:path] [/SD:path] [/?]
If that’s not clear enough for you, Microsoft includes a 33 page
Word file explaining the options! I’ve read through it, and I
end up using only four of the options:
/E
Just like the /E option for xcopy, this says to copy
empty directories, too./XD Directory
Don’t copy contents of any directories that have Directory
in their paths./XD ExFile
Don’t copy any files that have ExFile in their names./XO
Don’t copy files that are older in the source than in the
destination.
There are probably several ways to get robocopy, but the easiest
way I know is to install the
Microsoft
Windows Server 2003 Resource Kit. The download is an installation
program that will install all the tools, and add their location to
your path (important for command line tools like most of
these). Even though this is Windows 2003 toolkit, the tools I’ve
used say they work under Windows 2000 and Windows XP, too.
In addition to robocopy, the kit includes a lot of very
specialized tools that I won’t use, plus a few of general interest:
- Cdburn.exe: ISO CD-ROM Burner Tool (so you can create installation
CDs for Linux!) - Dvdburn.exe: ISO DVD Burner Tool
- Instsrv.exe: Service Installer
- List.exe: List Text File Tool (a clone of an ancient DOS utility
that I always loved, and missed until I got this; it’s a lightning
fast tool to display and search files in both text and hex modes) - Qgrep.exe (a clone of Unix’s grep)
- Remapkey.exe: Remap Windows Keyboard Layout
- Srvany.exe: Applications as Services Utility
- Tail.exe (Like Unix tail, it shows the end of a text file. It
also can show the end of the file as it grows, really useful for
watching log files while debugging. That requires almost the
same command line option as in Unix. Unfortunately, it’s the
opposite case, -f instead of -F!) - Timeit.exe (times how long commands take, keeps the times in a
database, and reports on statistics from the database)
As always, ask the IT department (via RT) if it’s okay for you to
install this software. Given the nature and source of the software,
I expect they’ll okay it for most of you.