Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between xcopy and robocopy

I'm kind of new to batch scripting. As a newbie I find both both of them useful while scripting What are the key differences between xcopy and robocopy?

like image 372
tourist Avatar asked Jun 09 '14 13:06

tourist


People also ask

Did Robocopy replace xcopy?

XCOPY was older and unreliable, so Microsoft replaced it with ROBOCOPY , which is still rubbish.

What is better than xcopy?

The best alternative is TeraCopy, which is free. Other great apps like XCOPY are rsync, Ultracopier, Robocopy and SuperCopier. XCOPY alternatives are mainly File Copy Utilities but may also be File Sync Tools or File Managers.

How is xcopy different from copy?

xcopy is an external program, while copy is part of the interpreter (cmd.exe, command.com). This means that xcopy might not be present on another machine or a rescue disk. Since we have Windows and rescue CDs, that isn't really an issue anymore. copy can concatenate files.


1 Answers

Robocopy replaces XCopy in the newer versions of windows

  1. Uses Mirroring, XCopy does not
  2. Has a /RH option to allow a set time for the copy to run
  3. Has a /MON:n option to check differences in files
  4. Copies over more file attributes than XCopy

Yes i agree with Mark Setchell, They are both crap. (brought to you by Microsoft)


UPDATE:

XCopy return codes:

0 - Files were copied without error. 1 - No files were found to copy. 2 - The user pressed CTRL+C to terminate xcopy. enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line. 5 - Disk write error occurred. 

Robocopy returns codes:

0 - No errors occurred, and no copying was done. The source and destination directory trees are completely synchronized. 1 - One or more files were copied successfully (that is, new files have arrived). 2 - Some Extra files or directories were detected. No files were copied Examine the output log for details.  3 - (2+1) Some files were copied. Additional files were present. No failure was encountered. 4 - Some Mismatched files or directories were detected. Examine the output log. Some housekeeping may be needed. 5 - (4+1) Some files were copied. Some files were mismatched. No failure was encountered. 6 - (4+2) Additional files and mismatched files exist. No files were copied and no failures were encountered. This means that the files already exist in the destination directory 7 - (4+1+2) Files were copied, a file mismatch was present, and additional files were present. 8 - Some files or directories could not be copied (copy errors occurred and the retry limit was exceeded). Check these errors further. 16 - Serious error. Robocopy did not copy any files. Either a usage error or an error due to insufficient access privileges on the source or destination directories. 

There is more details on Robocopy return values here: http://ss64.com/nt/robocopy-exit.html

like image 80
Nicolas Tyler Avatar answered Sep 21 '22 12:09

Nicolas Tyler