Robocopy (Robust File Copy) and XCopy are two command line tools often used in file transfers for Windows. XCopy is included in most versions of Windows, but has been less used as Robocopy is distributed with both Windows Vista and Windows 7. Robocopy is also part of the Windows Resource Kit. For all types of mass file copying, both are useful programs, but Robocopy has some options that make the job easier.
Robocopy, unlike XCopy, is used to mirror — or synchronize — directories. Instead of copying all of the files from one directory to another, Robocopy will check the destination directory and remove files no longer in the main tree. It also checks the files in the destination directory against the files to be copied and doesn't waste time copying unchanged files.
Using the "Run Hours" (/RH) option with Robocopy allows you to set when copies should be done rather than the time of the command as with XCopy. This automation is most useful for making daily backups or for large batch jobs that will take some time but require no interaction.
Note that the robocopy.exe process will be present in the task list since it checks the clock to see when to copy. Robocopy also supports logging — with the /LOG:file option; and retrying — defaults are 1 million tries, 30 seconds apart — for further automation.
Robocopy supports file and directory monitoring with the "/MON" or "/MOT" commands. "/MON:n" copies the file to the destination with n or more changes, while "/MOT:m" checks the file every "m" minutes for any changes, then copies it when there are. This is similar to periodically saving a file while working on it, only more efficient. XCopy has no monitoring support.
Video of the Day
Both XCopy and Robocopy have support for copying over the "archive" attribute on files, but Robocopy takes this a step further — it supports copying over all attributes — including timestamps, security, owner, and auditing info. These additional attributes help in maintaining a proper directory structure, especially when copying as an administrator.