Quick fix: Use robocopy in list mode (doesn’t copy, just lists differences): robocopy "C:\Source" "D:\Target" /e /l /njh /njs. Output: files that would be copied. /l = list only, /e = include subdirs, /njh /njs = no job header / summary. To compare bidirectionally: also robocopy "D:\Target" "C:\Source" /e /l /njh /njs.
robocopy’s /l flag: list files that would be processed without actually copying. Useful for comparing two directories. Shows extra files, missing files, files with different timestamps.
Affects: Windows 11.
Fix time: ~30 minutes (depending on drive size).
What causes this need
Compare two drives to:
- Verify backup completeness.
- Find missing files.
- Sync directories.
- Audit data integrity.
- Pre-flight before merging.
Method 1: List mode for comparison
The standard route.
- Open Command Prompt.
- Run:
robocopy "C:\Source" "D:\Target" /e /l /njh /njs- /e: include all subdirectories.
- /l: list only; don’t copy.
- /njh: no job header.
- /njs: no job summary.
- Output: files in Source that don’t match Target (would be copied).
- Reverse direction for missing in Source:
robocopy "D:\Target" "C:\Source" /e /l /njh /njs - For showing extra files in target:
/xxflag. - For verbose detail:
/vshows skipped files too.
This is the standard fix.
Method 2: Detailed report with /log
For documentation.
- Save comparison to file:
robocopy "C:\Source" "D:\Target" /e /l /v /log:C:\compare.log - Open
compare.login Notepad / Excel. - Categories:
- Same: file in both, matching attributes.
- Newer: file in target is newer.
- Older: file in target is older.
- Lonely: file in source but not target.
- Extra: file in target but not source.
- For Excel analysis: parse log columns.
- For PowerShell parsing:
Get-Content C:\compare.log | Where-Object { $_ -match "Lonely|Extra" } - For comparing file count:
(Get-Content C:\compare.log).Count. - For automated comparison: scheduled script that emails differences.
This is the detailed route.
Method 3: Sync after comparison
For acting on differences.
- After comparison, sync source to target:
robocopy "C:\Source" "D:\Target" /e /copy:DAT /xo- /xo: exclude older (don’t overwrite newer at target).
- For mirror (delete extra from target):
robocopy "C:\Source" "D:\Target" /mirCaution: deletes!
- For bidirectional sync: not native robocopy. Use Microsoft SyncToy (legacy) or FreeFileSync (free).
- For chronic backup verify: scheduled robocopy /l + email report.
- For specific file types:
robocopy ... *.docx /e /l. - For exclude patterns:
/xf [pattern]exclude files,/xd [pattern]exclude directories.
This is the sync route.
How to verify the fix worked
- robocopy output lists files differing between source and target.
- Log file readable.
- Comparison shows expected differences.
- If sync follows: drives match.
If none of these work
If output unclear: Verbose flags: /v shows more detail. For binary content comparison: robocopy compares size + timestamp + attributes by default. For byte-level comparison: fc /b file1 file2 (Windows fc tool). For large file count: log files can be huge. Use specific filters. For network drives: slow. Wait or compare locally first. For permissions comparison: /copy:DATSO includes security. For unicode filenames: robocopy handles. For dedupe-based backups: special tools required. Borg, Restic for chunk-level comparison.
Bottom line: robocopy "C:\Source" "D:\Target" /e /l /njh /njs for comparison only. Reverse direction for files missing in source. /log: for saving report. Add /mir to sync after.