Recommended Free Tools
Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Robocopy exit codes do not follow the usual “zero is success, anything else is failure” rule. Microsoft documents codes 0 through 7 as outcomes in which no copy failure was encountered, while 8 or higher means at least one failure occurred. A lower code can still report skipped files, destination-only files, or mismatches, so read the code with Robocopy’s summary and log before declaring a backup complete.
What is the Robocopy failure threshold?
The practical dividing line is 8. Microsoft’s current Robocopy command reference states: “Any value equal to or greater than 8 indicates that there was at least one failure during the copy operation.” Codes below 8 describe combinations of copied, skipped, extra, and mismatched items without a failure encountered.
As an Amazon Associate I earn from qualifying purchases.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesThat rule answers only whether Robocopy recorded a failure condition. It does not prove that every file you intended to include was eligible, that the destination contains no unexpected data, or that an independent backup verification has been completed. Those questions require the command options, summary, per-file output, and log.
What does each Robocopy exit code mean?
| Code | Microsoft’s documented meaning | How to read it |
|---|---|---|
0 |
No files were copied; no failure or mismatch was encountered. The files already existed in the destination. | No changes were needed according to Robocopy’s comparison. It does not mean that new files were copied. |
1 |
All files were copied successfully. | Robocopy reports copy activity with no failure condition. |
2 |
Additional files exist in the destination but not in the source; no files were copied. | The destination has extra items relative to the source. Decide whether those extras are intentional. |
3 |
Some files were copied and additional destination files were present; no failure was encountered. | Copying occurred, and the destination also contains source-absent items. |
4 |
The current Microsoft table does not provide a separate description for this value. | Do not invent a meaning. Review the run summary and log, and treat the documented threshold rule as the authority. |
5 |
Some files were copied and some files were mismatched; no failure was encountered. | Copying occurred, but the mismatch details need review. |
6 |
Additional and mismatched files exist; no files were copied and no failures were encountered. The table explains that the files already exist in the destination. | This run made no copies, but both mismatch and extra-file conditions were reported. |
7 |
Files were copied, a mismatch was present, and additional files were present. | Copy activity occurred alongside both mismatch and destination-extra conditions. |
8 |
Several files did not copy. | A failure was encountered. The same failure rule applies to every value greater than 8. |
The table explicitly lists 0, 1, 2, 3, 5, 6, 7, and 8. It does not individually explain code 4 or every value above 8. For those values, use the output and log to identify the affected paths instead of assigning an unsupported, code-by-code definition.
Popular on Amazon
- 【90 Degree Full Function USB C Adapter】Supports the latest USB4 standard for up to 40Gbps of bandwidth, 8K video support, and up to 240W Fast charging; Support USB PD 3.1 Extended Power Range (EPR) including 140W, 180W and 240W. Your productivity is easily doubled. *Warm Tip: For the best fit, please make sure the USB-C port is fully exposed; thick or bulky cases may affect compatibility.
- 【Reliable Quality】Made from high-quality, scratch-resistant aluminum alloy, delicate metal frame. get excellent wear resistance and heat dissipation. Non-Slip Design for easier insertion and removal.
- 【Small and portable】Ultra thin size, ultra compact design, a petite physique that matches the minimalist design of your modern laptops. Coming with a slim figure that won't block the port next to the one it's plugged into.
- 【Compatibility】Widely work with most usb c, thunderbolt 4/3 devices. Compatibilit for ROG Ally, Steam Deck, Switch, MacBook Pro, Quest 3 VR headset, Surface Book 2, iPhone 18/17/16/15, Samsung Galaxy S23/S22/S21, Note 20/10, Google Pixel, ChromeBook, etc.
- 【Excellence Customer Support】If you experience any issues or cable failure, simply reach out to our dedicated customer service team. We provide a prompt response within 18 hours, providing you with the necessary technical support to resolve any concerns.
Is a nonzero Robocopy code always a failure?
No. Codes 2, 3, 5, 6, and 7 are nonzero but are documented as runs in which no failure was encountered. They communicate state about destination-only files, mismatches, or combinations of those conditions.
For example, code 3 means Robocopy copied some files while also finding files that exist only at the destination. That can be perfectly normal when the destination intentionally contains additional data. Code 5 similarly can be acceptable when a mismatch is expected and has been investigated. In an automated job, however, you may still choose to alert on these codes because your policy may require an exact mirror rather than merely a run without copy failures.
Conversely, code 0 is not a “nothing happened” error. It means no files needed copying under Robocopy’s comparison and no failure or mismatch was encountered. If you expected a newly created backup, code 0 should prompt you to check the source path, filters, timestamps, and destination rather than assuming the backup was freshly produced.
What does Robocopy exit code 1 mean?
Code 1 means Robocopy reports that all files were copied successfully. It is the ordinary positive result when the run found work to do and completed it without a failure condition.
Still, confirm that “all files” means all files your command selected. Options that exclude names, extensions, directories, or attributes can make the eligible set smaller than the data set you had in mind. Review the command line and the summary before treating code 1 as proof that every desired item exists at the destination.
Also popular on Amazon
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Is Robocopy error level 3 a failure?
No. Microsoft’s table classifies code 3 as some files copied, with additional files present at the destination, and no failure encountered. It is therefore below the documented failure threshold.
Whether code 3 is acceptable depends on the job’s purpose. For an additive copy, destination extras may be expected. For a strict one-way mirror, extras indicate that the destination is not an exact representation of the source and should be investigated or removed only through an option that you deliberately selected.
Does Robocopy code 8 mean the copy failed?
Code 8 means Robocopy encountered at least one failure; Microsoft’s rule extends that conclusion to every return value of 8 or higher. The code alone does not identify the cause, the number of affected files, or whether the rest of the files copied successfully.
Inspect the summary and log for the file names and paths that could not be copied. Check access permissions, path spelling, connectivity to a remote location, source and destination availability, and any filters or exclusions. After correcting the cause, rerun the intended command and evaluate the new code and log rather than assuming a rerun repaired everything.
How do I capture and test the return code in a script?
Record the process status immediately after Robocopy finishes, before another command replaces the shell’s status value. Then branch on the documented threshold: values below 8 are not classified by Microsoft as copy failures, while values of 8 or higher require investigation.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Also popular on Amazon
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Windows command (.bat or .cmd)
robocopy C:Source D:Backup /E /LOG:C:LogsBackup.log
set "rc=%ERRORLEVEL%"
if %rc% GEQ 8 (
echo Robocopy reported a failure: %rc%
exit /b %rc%
) else (
echo Robocopy completed without a documented failure: %rc%
)
The set line saves the value before later commands run. Keep the saved value if your script needs to write a notification, cleanup message, or other diagnostic output.
PowerShell
robocopy C:Source D:Backup /E /LOG:C:LogsBackup.log
$rc = $LASTEXITCODE
if ($rc -ge 8) {
Write-Error "Robocopy reported return code $rc"
exit $rc
}
Write-Host "Robocopy completed without a documented failure: $rc"
Do not convert every nonzero result into a generic failure without deciding what your workflow expects. A policy that requires no mismatches or no destination extras can intentionally reject codes below 8, but that is a stricter policy than Microsoft’s failure classification.
What should I check after a Robocopy run?
- Save the code. Capture it immediately in the shell or automation system.
- Read the summary. Look for counts of copied, skipped, mismatched, failed, and extra items. The code is a classification, not a file-by-file report.
- Review the log. Microsoft documents
/LOG:to write output to a file and/LOG+:to append output. A persistent log lets you inspect paths after a scheduled job has ended. - Confirm the selection rules. Recheck source and destination paths, file and directory filters, exclusions, and property comparisons. A successful result for an unintended selection is still the wrong backup.
- Decide whether extras are expected. Codes 2, 3, 6, and 7 involve destination-only items. They may be harmless, or they may show that the destination is accumulating data.
- Investigate mismatches. Codes 5, 6, and 7 report mismatched conditions. Compare the logged paths with the purpose of the job before accepting them.
- Apply your verification policy. A code below 8 says that Robocopy did not encounter a documented copy failure; it does not independently verify every desired byte or prove that the destination can be restored.
Which Robocopy options change how the result should be interpreted?
The command’s switches define what Robocopy considers eligible and how it handles the destination. The most important distinctions are:
/Scopies subdirectories but excludes empty directories./Eincludes empty directories as well as subdirectories./Zenables restartable mode, which is useful when a transfer may be interrupted./COPY:controls which file properties are copied. The selected properties affect what Robocopy compares and transfers./MIRmirrors the directory tree and is equivalent to/Eplus/PURGE./PURGEremoves destination files and directories that no longer exist in the source./R:sets the retry count, and/W:sets the wait time between retries.
Mirror and purge behavior deserves special care. A destination-only file can be reported as an extra item in a non-purging run. With /MIR, destination content absent from the source is subject to removal. Use that switch only when deleting such destination items is part of the intended design.
Free tools Windows power users keep installed
One-click scans. No signup required.
Microsoft’s logged mirror example is:
robocopy C:UsersAdminRecords D:Backup /MIR /R:2 /W:5 /LOG:C:LogsBackup.log
Here, /R:2 limits retries to two and /W:5 waits five seconds between retries. Explicit settings make scheduled jobs easier to reason about than relying on defaults, especially when a disconnected or slow path could otherwise delay completion.
Also popular on Amazon
- Portable and powerful USB-C HUB: BENFEI USB Type-C HUB, with super-soft and knot-free silicone woven design cable, meets most mobile office needs. Compact, lightweight, stylish, and powerful portable USB C Hub equipped with 1 x HDMI port, 1 x 100W charging, and 3 x USB ports. 18-month warranty, 24-hour response, to ensure you feel at ease when using our product.
- Design centered on comfort and reliability: Thanks to BENFEI's end-to-end in-house cable production capability, in-house PCBA and assembly capability, using the industry's most advanced silicone woven design and process, 20cm cable in length, no knots, super-soft, the HUB is easy to use in all scenarios: laptop, tablet, stand etc. Super-soft, 25000+ life cycles, to meet your daily carrying and office needs.
- 100W Charging: Support up to 90W USB C pass-through charging via Type-C port to keep your laptop powered. 10W is reserved for other interface operations. No data and video function on the Type-C port.
- 4K HDMI Display: The HDMI port supports media display at resolutions up to 4K 30Hz, keeping every incredible moment detailed and ultra vivid. Please note that the C port of the Host device needs to support video output.
- Transfer Files in Seconds: Transfer files and from your laptop at speeds up to 10 Gbps with USB A 3.2 port. Extra 2 USB A 2.0 ports are perfectly for your keyboards and mouse.
How do I troubleshoot a return code of 8 or higher?
- Find the failed entries in the log. Start with the paths marked as failed or accompanied by an operating-system error message.
- Separate systemic from individual failures. If many files under one location fail, check the share, drive, credentials, and permissions. If one or two files fail, check locks, names, length limits, or file-specific access.
- Check that both paths are available. A disconnected destination, unavailable network share, or mistyped path can produce a failure even when the command itself is valid.
- Review retries and waits. A transient connection can sometimes be handled by an intentional
/R:and/W:policy; do not confuse waiting with successful completion. - Check filters and properties. Make sure the command is not excluding the items you are trying to recover and that
/COPY:matches your preservation requirements. - Rerun after correcting the cause. Preserve the original log, run the corrected command, and compare the new summary with the original failed paths.
A return value of 8 or more is evidence that at least one failure occurred, not a diagnosis. The log and the operating-system message attached to each failed path provide the actionable detail.
How can I tell whether Robocopy copied all the files I intended?
Use a three-part check: the command, the run summary, and the destination. First, confirm that the source and destination are correct and that no include or exclude switch narrows the job unexpectedly. Second, read the summary for failed, skipped, mismatched, and extra counts instead of looking only at the exit code.
Third, compare the destination with the job’s purpose. A code 1 can be right for a normal copy, while code 0 can be right for an already synchronized destination. If your requirement is an exact mirror, destination extras and mismatches matter even when Microsoft classifies the return value as below 8. If your requirement is simply to copy newly changed files without deleting destination content, those same conditions may be acceptable.
Which Windows versions does the current documentation cover?
The current Microsoft Learn command page lists Windows 10, Windows 11, Windows Server 2016, Windows Server 2019, Windows Server 2022, Windows Server 2025, and Azure Local 2311.2 and later. A separate Microsoft troubleshooting page shows the same return-code table for Windows Server 2008 and Windows Server 2008 R2; that page is useful historical corroboration, not evidence that those older platforms define the current support scope.
A quick decision checklist
- Code 0: no files copied; no failure or mismatch reported. Check that this was expected.
- Code 1: files copied successfully according to Robocopy. Confirm the command selected the intended data.
- Codes 2 or 3: destination-only extras exist. Decide whether they are intentional.
- Codes 5, 6, or 7: mismatches exist, with or without copied files and extras. Review the affected paths.
- Code 4: the current table does not give a standalone description. Use the summary and log.
- Code 8 or higher: at least one failure occurred. Investigate the logged entries before accepting the job.
The most reliable interpretation combines the documented threshold with the actual operation you intended. Robocopy’s return code is an important first signal, but the log, summary, options, and destination state determine whether the job met your backup or synchronization goal.
Also popular on Amazon
- 【Read before You Buy】 Note: This adapter is USB 2.0 version and cannot transmit HDM, VGA, or other video signals. Nevertheless, they are fully capable of charging devices,duplicating files, and can be seamlessly integrated with USB-C earphones, wireless network adapters, and SD card adapters.
- 【Easy to Use and Safe】Thanks to modern manufacturing techniques, we've made these adapters sufficiently compact so that they can remain inserted in your device without noticeable protrusion or inconvenience. This means you don't have to constantly plug and unplug them, reducing the likelihood of wear and misalignment, and making them more convenient to carry around.
- 【Reliable Quality】Engineered for enhanced durability, durable aluminum alloy shell material,get excellent wear resistance and heat dissipation,the male USB C and female USB connectors & the male USB and female USB C connectors are designed to be plugged and unplugged up to 20000 times. Provides data transfer, device charging, memory space expansion, and additional computer peripherals.
- 【Think more for you】Do you need to connect a USB-C-enabled device to an odd device that only has USB-A ports? Then these USB-A male to USB-C female adapters are made for you.Simply insert the adapter into the USB-A port on the device, and you can instantly connect your USB-C device to the device that originally didn't have the correct connection port.
- 【Trusted xiwxi Quality and Service】As a responsible brand seller, you will receive xiwxi's 12-month Quality assurance and lifetime friendly customer service, you're not just buying a product,you're investing in peace of mind with all-round quality and exceptional customer service.
Frequently Asked Questions
Can I treat every code below 8 as a successful backup?
You can treat it as a run with no failure condition according to Microsoft’s return-code rule, but not as independent proof of a restorable backup. Check that the selected files, destination state, and required file properties match your backup policy.
Why did Robocopy return code 0 when I expected files to copy?
Code 0 means Robocopy found no files to copy and no failure or mismatch. Verify the source and destination paths, filters, timestamps, and whether the destination already contains the files under Robocopy’s comparison rules.
Should I use /MIR for every backup job?
No. /MIR includes purge behavior, so destination items absent from the source can be removed. Use it only when an exact mirror is intended; choose a non-purging command when destination history or extra files must be retained.
Does increasing /R: fix a Robocopy failure code?
Retries can help with a temporary interruption, but they do not guarantee success and do not change the meaning of the final code. Set an intentional retry and wait policy, then inspect the final log and return value.

