ROBOCOPY, What is the meaning of "mismatch" and "failed"

Anyone could please clarify what's the meaning of the columns MISMATCH and FAILED in the Run summary?


Failed means the copying process of a file should have but did not work. Mismatch means that the source is a directory and the (existing) target is a file (or vice versa).

Source: Robocopy.doc (here and here as an external link, I can't find the official MS link at the moment) on page 15 (first link) refers to the source being a file and the target being a directory. Few pages down you get the specific explanations:

Mismatch (File Tag): The source file corresponds to a destination directory of the same name. The source file is skipped, and housekeeping of the destination tree is recommended.

Mismatch (Directory Tag): This source directory corresponds to a destination file of the same name and cannot be processed. Housekeeping of the destination is recommended.

What this means for the copying process:

Failed is an error meaning not all files were copied. Uncopied files will result in a return code 8 and higher. Mismatch is error code 4-7 (actually just 4, 5-7 are combination of 4 with another code). To my understanding all the (different) files were copied (assuming you use the purge switch, without the switch mismatches will be skipped).

I would save a detailed log and see what file/dir the mismatch applies to.

In the return codes you'll find:

Value   Description
4       Mismatched files or directories were detected.  Examine the log file for more information.
5       Some files were copied. Some files were mismatched. No failure was encountered.
6       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       Files were copied, a file mismatch was present, and additional files were present.

See here (ss64) or here (MS) or here (MS) or here (blog) for error code sources.

Here's the info on the purge tag:

Maintaining True Replication

If you require the destination directory tree to be maintained as an exact mirror of the source directory tree, you must delete files and directories from the destination whenever they disappear from the source. To accomplish this, use the /E and /PURGE switches in combination, or use the /MIR switch

The /PURGE switch causes Robocopy to delete all Extra and Mismatched destination files and directories. After a Mismatched destination entry has been deleted, the corresponding source entry is then treated as a Lonely file or directory and processed accordingly. When /PURGE results in the deletion of an Extra or Mismatched destination directory, the entire directory tree, including all subordinate files and subdirectories, is deleted (even if /S or /E is not specified).

PS: I just answered this question: Any way to make Robocopy produce “failed” and “mismatched” files for testing purposes?, if you need to reproduce failed and mismatched.