The Coolest Command-Line Tool in Windows Vista
Perhaps this is ironic for someone who has a heavy focus on beautiful client interfaces, but I've always been a bit of a command-line junkie. Maybe it's a fetish, maybe it's just a legacy of the early DOS, VAX/VMS and UNIX systems that I used in my formative years, but I've always rather liked the uncluttered "get stuff done" experience of a shell.
One particularly common motivation for me to drop back to the Windows Vista command shell is to copy files. For years, robocopy has been an essential part of the Microsoft engineer's toolkit. When I was back in the UK, it was about the only sane way to copy large file structures over the WAN from Redmond, but even now, it's one of the most trusted and useful tools in my toolbox - the first thing I copy over onto a fresh installation to help manage everything that will follow.
Robocopy has been around as an independent tool for a little while (primarily in the Windows Resource Kits), but finally in Windows Vista, someone has seen fit to give the little tool the recognition it deserves, and as a result it now sits on a high pedestal in the \windows\system32 directory on every Windows Vista installation.
Why is robocopy so cool? Well, for starters, it's hard to find a more flexible, configurable tool - with over 80 switches, the chances are it can handle any batch or synchronous copy you have in mind.
Secondly, it's just very robust. If a network link goes down halfway through a lengthy copy, most tools bail out, but robocopy just patiently waits, retrying x times with a y second interval (of course, x and y are configurable). Better still, it can be configured to pick up where the file transfer left off, so you don't have to go all the way back to the start if the network fails 99% of the way through a 2GB file.
Finally, it's perfectly optimized for mirroring large file shares on a slow WAN link. It only copies files that have changed, which is perfect for the occasions when you want to pull down a daily build where only 30% of the files have changed since the last occasion. You can set it to monitor a source and keep the destination updated with changes on a repeated schedule. Lastly, you can even throttle the traffic down by tweaking the inter-packet gap, so that a network link isn't monopolized by the copy process.
I use robocopy for copying new daily builds down from a central server, for backing up my personal and work files to shared locations, and simply for moving files around from partition to partition. Even as I write this, there's a robocopy window mirroring my entire data partition to a removable USB hard drive so that I can transfer my data from one laptop to another.
If you're not running Windows Vista already (shame on you!), you can download robocopy as part of the Windows Server 2003 Resource Kit Tools (where there's also a user manual in Word format for the tool). If you're not a command-line junkie, there's a GUI wrapper available from GotDotNet, although it doesn't really provide much more than a shell for the switches. Start with the /mir and /z switches to get a sense of the power of the tool (but be careful with /mir since it will delete as well as copy files to bring the destination folder in sync with the source folder). Run robocopy /? to see the full set of parameters available. Good luck!
Comments
- Anonymous
September 07, 2006
Aaah, another RoboCopy fan - I use it a lot to backup my computers to USB HDDs.
Only problem is, sometimes the drive letter of the USB hdd changes - I wonder if there will be a way someday to address a drive using its volume label, would help a lot for external drives. - Anonymous
September 07, 2006
Ah - an rsync for Windows. This could be useful! - Anonymous
September 08, 2006
I'm more of a Beyond Compare man, myself. It's the best of both worlds: you can visually compare and merge filesystems as well as individual file contents.
http://www.codinghorror.com/blog/archives/000454.html - Anonymous
September 09, 2006
Now I now why Delta Forth .NET had immediately appealed to you :-) If I had written a fancy UI, I bet you wouldn't have noticed the Forth compiler at all.
I must admit I have never tried robocopy although just yesterday I was involved in processing a directory structure with some 14,000 font files. I will definitely give Robocopy a try. - Anonymous
September 11, 2006
Seems like rsync for Windows :) - Anonymous
September 19, 2006
PingBack from http://www.session0.com/?p=26 - Anonymous
September 24, 2006
I used robocopy to make mirrors of my docs, my music, my pictures etc.
Be careful of the Vista junctions (eg c:usersausdocumentsmy music -> c:usersausmusic) otherwise you may get two copies of everything in music, pictures and videos.
I had to use switch /XJ - Anonymous
December 10, 2006
It would be good if robocopy supported delta copies, as Rsync does.