Robocopy’s
Do not reverse them. Robocopy evaluates changes relative to the first path (source) and second path (destination).
Windows 11
Press Enter.
What each important switch does:
Expected result: Robocopy scans the two folder trees and displays a header, file and folder results, then a summary table. The run can take several minutes for a large folder tree or a slow network share, even though no files are copied.
The log is saved as:
Common items to look for include:
Because this is a listing-only run, do not interpret the word Copied in the summary as actual transfer activity.
To display the return code immediately after the command finishes, enter:
For a dry-run comparison, use the exit code as a health indicator:
Use exclusions cautiously. An exclusion means Robocopy will not use those items to make the destination match the source.
Use
Common causes:
Do not use a mapped drive letter unless it is visible in the same user session where Command Prompt is running.
If the path is protected and you have authorization, reopen Command Prompt or Windows Terminal using Run as administrator, then rerun the dry run. Do not add
Use
to exclude directory junctions only, or:
to exclude file junctions only.
For ordinary backup and sync jobs,
Rerun the preview and compare the results. Use
The main command uses
You accidentally ran a real
Stop the command promptly with Ctrl+C. Do not run additional mirror commands while assessing the result.
Recovery options depend on what was changed:
/L switch performs a dry run: it compares a source folder and destination folder, then lists the files and folders that its command would copy, update, or—when used with /MIR—delete, without changing either location. This guide applies to Windows 10 and Windows 11. Use /L with the same switches you plan to use for the real sync, especially if the eventual job will mirror folders.
Prerequisites and compatibility
- A Windows 10 or Windows 11 PC with the built-in
robocopy.execommand. No download or restart is required. - Read access to the source folder and destination folder. Write access is not required for a true
/Ldry run, but some protected locations can still produce access-denied messages while Robocopy enumerates them. - Enough free space for a text log if you choose to create one.
- The exact source and destination paths. They can be local paths, external drives, or network shares.
- Source:
C:\Work\Project - Destination:
E:\Backups\Project - Network destination:
\\FileServer\Backups\Project
Warning —/MIRis destructive only when/Lis removed.
/MIRmeans “mirror,” which includes removing destination-only files and folders during a real run. With/L, Robocopy only lists those potential deletions. Do not remove/Luntil you have reviewed the log and confirmed that every listed extra destination item is safe to remove.
Primary procedure: preview a mirror sync before running it
1. Identify the source and destination folders
Decide which folder is authoritative:- The source is the folder whose current contents you want the destination to match.
- The destination is the backup, external drive, network share, or second folder you intend to update.
C:\Work\Project is your current work folder and E:\Backups\Project is the backup, use:
Code:
Source: C:\Work\Project
Destination: E:\Backups\Project
2. Create a folder for dry-run logs
Creating a log makes it easier to review a large comparison and retain a record before you synchronize.- Open File Explorer.
- Create a folder such as:
C:\RobocopyLogs - Ensure the folder is on a local writable drive.
3. Open Command Prompt
Use a normal Command Prompt window for ordinary folders.Windows 11
- Right-click Start.
- Select Terminal.
- If it opens PowerShell, select the down arrow next to the tab bar and choose Command Prompt.
- Select Start.
- Type
cmd. - Select Command Prompt.
C:\Windows, or C:\Program Files, right-click Command Prompt and select Run as administrator only if you are authorized to inspect those files.4. Run a full dry-run mirror comparison
Enter the following command, changing both paths for your folders:robocopy "C:\Work\Project" "E:\Backups\Project" /MIR /L /XJ /FP /TS /BYTES /R:0 /W:0 /TEE /LOG:"C:\RobocopyLogs\Project-dryrun.txt"Press Enter.
What each important switch does:
| Switch | Purpose in this dry run |
|---|---|
/MIR | Selects mirror behavior: include subfolders and identify destination items that do not exist in the source. |
/L | Lists actions only. It does not copy, delete, or change timestamps. |
/XJ | Excludes junction points, reducing the risk of traversing redirected or repeated folder paths. |
/FP | Displays full paths, making entries easier to identify. |
/TS | Shows source timestamps. |
/BYTES | Shows sizes in bytes instead of rounded units. |
/R:0 /W:0 | Avoids long retry delays for inaccessible files or unavailable network locations. |
/TEE | Shows results on screen and writes them to the log. |
/LOG: | Creates or overwrites the specified log file. |
The log is saved as:
C:\RobocopyLogs\Project-dryrun.txt5. Read the listed differences before syncing
Review the output in Command Prompt or open the log in Notepad. Focus on the file classifications and destination-only entries.Common items to look for include:
- New File: present in the source but absent from the destination. A real run would add it to the destination.
- Newer: the source version is newer than the destination version. A standard sync would update the destination copy.
- Older: the source version is older than the destination copy. Review this carefully; it may indicate that the destination has a newer file you do not want overwritten.
- Changed or Modified: metadata, timestamp, size, or other compared properties differ. Robocopy’s normal comparison is not a cryptographic hash comparison.
- Extra File or Extra Dir: exists in the destination but not the source. Because this dry run includes
/MIR, a real run would delete these destination-only items.
6. Check the summary and return code
At the end, Robocopy reports totals for directories and files, including copied, skipped, mismatched, failed, and extras.Because this is a listing-only run, do not interpret the word Copied in the summary as actual transfer activity.
/L prevents data copying, deletion, and timestamp changes. Instead, treat those counts as the operations Robocopy selected for the proposed real run.To display the return code immediately after the command finishes, enter:
echo %ERRORLEVEL%For a dry-run comparison, use the exit code as a health indicator:
0generally means no selected differences and no failures.1through7can represent detected differences without a copy failure.8or higher means Robocopy encountered at least one failure, such as access denied, an unavailable share, or an invalid path.
8 or higher, resolve the reported errors before relying on the comparison.7. Make corrections, then rerun the same dry run
If the preview shows unexpected items:- Correct the source or destination path.
- Add exclusions for content that should not be synchronized.
- Resolve network access or permission errors.
- Rerun the same
/Lcommand and review the new log.
Temp and all .tmp files from consideration:robocopy "C:\Work\Project" "E:\Backups\Project" /MIR /L /XJ /XD "Temp" /XF "*.tmp" /FP /TS /BYTES /R:0 /W:0 /TEE /LOG:"C:\RobocopyLogs\Project-dryrun.txt"Use exclusions cautiously. An exclusion means Robocopy will not use those items to make the destination match the source.
Verification of success
A successful comparison has these characteristics:- The command completes and returns an exit code below
8. - The source and destination paths shown in the Robocopy header are correct.
- The log contains the expected new and updated source items.
- Every
Extra FileandExtra Direntry is understood before a mirror operation is approved. - There are no unexpected
Access is denied,ERROR 53,ERROR 67, or path-not-found messages. - The
Failedcounts in the final summary are zero.
- No files selected for copying or updating.
- No extras listed.
- No mismatches or failures.
- Usually an exit code of
0.
Alternate method: preview additions and updates without evaluating deletions
Use this method when you want to update a backup but do not intend to delete destination-only files. Replace/MIR with /E:robocopy "C:\Work\Project" "E:\Backups\Project" /E /L /XJ /FP /TS /BYTES /R:0 /W:0 /TEE /LOG:"C:\RobocopyLogs\Project-copy-preview.txt"/E includes all subdirectories, including empty ones, but does not request mirror cleanup. This is the safer preview for a one-way copy where the destination may intentionally contain files not found in the source.Use
/MIR /L only when the real job is specifically intended to make the destination an exact mirror of the source.Troubleshooting and rollback/escalation
The command reports “ERROR 3” or says the system cannot find the path
Check both paths in File Explorer first.Common causes:
- A drive letter changed after reconnecting an external disk.
- A folder name is misspelled.
- A quoted path contains an accidental extra quotation mark.
- A network share is unavailable.
robocopy "C:\Work\Project" "\\FileServer\Backups\Project" /MIR /L /XJ /R:0 /W:0Do not use a mapped drive letter unless it is visible in the same user session where Command Prompt is running.
The command reports “Access is denied”
Confirm that your account can open the source and destination paths in File Explorer. Close applications that may lock files, such as Outlook, database tools, backup software, or editors working inside the folder.If the path is protected and you have authorization, reopen Command Prompt or Windows Terminal using Run as administrator, then rerun the dry run. Do not add
/B or /ZB merely to bypass permissions for a routine folder comparison: backup mode can override normal ACL restrictions and is inappropriate unless you understand and are authorized to use it.The dry run lists unexpected repeated folders or profile locations
Robocopy follows junction points by default. Junctions can redirect paths and cause unexpected traversal, especially under user profiles or system folders.Use
/XJ, as shown in the main command. If you need more targeted handling, use:/XJDto exclude directory junctions only, or:
/XJFto exclude file junctions only.
For ordinary backup and sync jobs,
/XJ is the safer default.Many files show as changed after copying to FAT32, exFAT, NAS storage, or older devices
Different file systems can record timestamps with different precision. Add/FFT to tell Robocopy to use FAT-style two-second timestamp tolerance:robocopy "C:\Work\Project" "E:\Backups\Project" /MIR /L /XJ /FFT /FP /TS /BYTES /R:0 /W:0 /TEE /LOG:"C:\RobocopyLogs\Project-dryrun.txt"Rerun the preview and compare the results. Use
/FFT only when the destination’s timestamp behavior warrants it; do not add it automatically for two NTFS folders.The dry run is slow or appears to pause on a network share
A dry run still has to enumerate directories and read file metadata. Confirm the share is reachable in File Explorer and that the connection is stable.The main command uses
/R:0 /W:0 to prevent a missing or inaccessible item from causing Robocopy’s otherwise lengthy retry behavior. If files are actively changing during the scan, wait until activity subsides and rerun the preview for a consistent result.You accidentally ran a real /MIR command without /L
Stop the command promptly with Ctrl+C. Do not run additional mirror commands while assessing the result.Recovery options depend on what was changed:
- Check the destination’s Recycle Bin only if the destination is a local drive and deletion behavior placed items there; do not assume Robocopy deletions are recoverable from it.
- Restore deleted destination-only files from a separate backup, File History, a cloud version-history service, a NAS snapshot, or a volume snapshot if available.
- Preserve the Robocopy log, if one was created, because it identifies affected paths.
- Before retrying, run the exact intended command again with
/Lrestored and review every listed extra destination item.