First of all, if you have never heard of it, Robocopy is a utility built by MS that is included in more recent versions of Windows (I believe Server 2003 and later). The name “robocopy” stands for robust file copy. It is a command line utility that is designed for reliable copying / mirroring files and directories on local or network resources (not P2P).
Part of my job at work is to help move user data from one machine to the next. This used to take hours per PC as I would use Windows Explorer to select a ton of files at once and start the copy. If one file failed, you would have to restart the whole batch, not knowing where you left off and having to overwrite or skip every file that had already been copied. After searching for a better way to do things I encountered Robocopy a couple of years ago.
Robocopy not only works via command line (so it supports scripting!), but it also has a more robust feature set than the regular copy or xcopy command. You can use it to execute copies to and from local drives, external drives, and network drives as well. You can specify which file attributes to copy, you can mirror entire directories, copy files with large file / directory names, specify files and directories to ignore, and retry with advanced options such as how many retires or how many seconds in between retries.
Here are a few examples of code that I use daily (these are of course inputted via a command prompt):
Robocopy c: m: /e /r:3 /w:3
In this example, the source dir is C:, the destination dir is M:, /e means to copy everything; all files, attributes, and directory structure, r:3 means retry each failed copy 3 times before moving on to the next file in the batch, and w:3 means wait 3 seconds in between retries.
robocopy c: m: /e /r:1 /w:1 /XF hiberfil.sys msdos.sys io.sys boot.ini pagefile.sys ntldr config.sys ntdetect.com .rnd bootsect.dos autoexec.bat thumbs.db /xd config.msi msocache recycler "documents and settings" "program files" "system volume information" windows winnt
This second example is similar to the first except for what appears after the wait options. /XF allows me to specify which files in c: I do not want to copy, and /xd allows me to do the same with directories. This command allows me to mirror any customer data that has been added since I ran a fresh install of Windows on a user’s computer.
There are plenty of creative ways to use this command. For example, one of the scripts that I wrote for work automatically maps a network drive and begins backing up customer data to my backup server when a customer brings in their dying PC. I also wrote a script that backs up my favorites to my dropbox every time I login to my PC, and syncs all data from my dropbox back to my favorites. I have this script installed on all of my PC’s, so no matter which machine I am on I have the latest copy of all of my favorites.
I share this in the hope that it might help some other file hoarder out there with TBs of Data ;)
You can find more information about Robocopy via Wikipedia here. For a complete list of Robocopy's command line switches try here or here. If you are running an older copy of Windows, or don’t seem to have robocopy installed, you can obtain it in the Windows Server 2003 Resource Kit Tools located here. Also, I know I hinted on it, but if you have no experience in creating Windows Batch files / scripts check out a nice Instructables link here. If anyone has any creative uses I would love to see them, or if anyone would like some help please just let me know!
P.S. If you're not into command lines at all, you may want to try Teracopy, located here. I use this daily as well and it is pretty sweet. I use this to move files from my download folder to the storage drives on my server (sometimes gigs at a time) without having to wait for each transfer to finish. Teracopy will overwrite the standard Windows file copy dialogue, allowing you to queue up file transfers and have them copy in succession so that your PC doesn't slow to a crawl in the meantime.









LinkBack URL
About LinkBacks
Reply With Quote

