How-To Guide

    How to Compare Two Folders With Robocopy (/L, No Copying)

    One built-in Windows command lists what differs between two folders and changes nothing. Here is the command, how to read it, and the two things it will not tell you.

    Published November 19, 2026Updated November 19, 20267 min read
    Mehrab Ali

    Author

    Mehrab Ali

    Founder & Executive Lead, ARCED International

    Founder of ARCED Foundation, ARCED International, and Solutions of Things Lab (SoTLab). Built FolderManifest to help teams protect file integrity and stay audit-ready.

    Quick Answer

    To compare two folders with robocopy, run robocopy "C:\FolderA" "D:\FolderB" /L /E /NJH /NJS /NP /NDL in Command Prompt. The /L switch makes robocopy list the differences and copy nothing. Files marked New File are missing from the second folder, *EXTRA File exists only in the second, and Newer, Older, and Changed exist in both but differ.

    Robocopy ships with Windows 10 and 11, so there is nothing to install. It compares by file size and modified time, not by content, which makes it fast and also means it can be wrong in both directions. Every command on this page was run on Windows 11 against a test pair with missing, extra, newer, older, and silently altered files.

    The Command, Switch by Switch

    robocopy "C:\FolderA" "D:\FolderB" /L /E /NJH /NJS /NP /NDL
    • /L: list only. Nothing is copied, deleted, or timestamped. This is the switch that turns a copy tool into a comparison tool, so make sure it is there before you press Enter.
    • /E: include all subfolders, empty ones too.
    • /NJH and /NJS: hide the job header and the summary table, leaving only the differences.
    • /NP: no progress percentages.
    • /NDL: do not print a line per folder. With it, every file line shows its full path.

    The first folder is the source and the second the destination. Robocopy answers the question “what would I have to do to the second folder to bring it up to date with the first?”, so the order changes the labels. Do not add /NC: it removes the class column, which is the part you need.

    Reading the Output

    Each line is a class, a size in bytes, and a path. Shortened output from our test pair:

        Changed            7    C:\FolderA\changed.txt
        Newer             20    C:\FolderA\newer.txt
        Older              5    C:\FolderA\older.txt
        New File           3    C:\FolderA\only in a\f.txt
      *EXTRA File          7    D:\FolderB\sub\extra in b.txt
        New File           9    C:\FolderA\sub\missing in b.txt
    ClassMeaning
    New FileOnly in the first folder (missing from the second)
    *EXTRA FileOnly in the second folder
    NewerIn both; the first folder's copy has a later modified time
    OlderIn both; the first folder's copy has an earlier modified time
    ChangedIn both; same modified time, different size
    New Dir / *EXTRA DirA folder only in the first / only in the second (shown without /NDL)

    Files that match are not listed. Add /V to see them too, /TS to print each file's timestamp, and /BYTES if large sizes are being shortened to m and g.

    Show Only One Kind of Difference

    Robocopy has an exclude switch per class. Leave out the classes you do not care about and the rest is your answer.

    Only files missing from the second folder:

    robocopy "C:\FolderA" "D:\FolderB" /L /E /NJH /NJS /NP /NDL /XX /XC /XN /XO

    Only files that exist in the second folder and not the first:

    robocopy "C:\FolderA" "D:\FolderB" /L /E /NJH /NJS /NP /NDL /XL /XC /XN /XO

    /XL hides files only in the first folder (“lonely”), /XX hides extras, /XC hides changed, /XN newer, and /XO older. To skip file types or folders entirely, use /XF *.tmp thumbs.db and /XD node_modules .git.

    Comparing against a FAT or exFAT drive, or a NAS? Add /FFT. Those file systems store times in two-second steps, and without it, files that are the same show up as Newer or Older. /DST does the same for one-hour daylight saving offsets.

    Extra Folders and Both Directions

    What happened in our test

    The second folder had a subfolder, only in b, that the first did not. The basic command listed nothing about it. Without /NDL it appeared as a single *EXTRA Dir line, and the file inside it was still not listed.

    Robocopy walks the first folder's tree, so it never descends into folders that exist only on the second side. There are two ways to see what is in them:

    • Swap the folders and run it again. What was extra becomes New File, with every file listed. Add /XX to keep the second pass short:
      robocopy "D:\FolderB" "C:\FolderA" /L /E /NJH /NJS /NP /NDL /XX
    • Use /MIR /L and drop /NDL. In list mode a mirror also prints the files it would purge, including those inside extra folders:
      robocopy "C:\FolderA" "D:\FolderB" /MIR /L /NJH /NJS /NP

    /MIR without /L deletes everything in the second folder that the first does not have. If you use this form, never reuse it from command history with the /L edited out. More on that switch in the robocopy /MIR warning.

    Save the Result and Exit Codes

    For anything bigger than a screenful, send the output to a file. /UNILOG keeps non-English file names readable, and /TEE prints to the screen as well:

    robocopy "C:\FolderA" "D:\FolderB" /L /E /NJH /NP /NDL /UNILOG:"C:\compare.txt" /TEE

    This version leaves out /NJS so the log ends with the summary table: total files, how many would be copied, how many were skipped as matching, and how many are extras. If you only want the totals, add /NFL to hide the file lines.

    In a batch file, check %ERRORLEVEL% right after the command. 0 means robocopy found nothing to copy and no extras. 1 to 7 mean it found differences (1 is files to copy, 2 is extras, 3 is both). 8 or higher means an error, such as a folder it could not open.

    What Robocopy Misses

    Robocopy has no checksum switch. It decides from size and modified time alone, and in our test that was wrong twice:

    • A changed file it called the same. Two files with the same name, size, and timestamp but different content were not reported. This is what a corrupted copy or an in-place edit by a tool that preserves timestamps looks like.
    • An identical file it called different. Two byte-for-byte identical files with different timestamps were reported as Newer. After a copy by a tool that does not keep dates, that can be every file in the folder.

    It also cannot spot a file that was renamed or moved (it shows up as one New File and one *EXTRA File), and it does not find duplicates. For a quick “did everything get copied?” check, size and time are usually enough. For a migration sign-off, a backup you will rely on, or anything you delete the original of, compare by content.

    Compare by Content Instead

    PowerShell and Get-FileHash

    This hashes every file on both sides and compares relative path plus SHA-256. It works in Windows PowerShell 5.1 and PowerShell 7:

    function Get-Hashes($root) {
      Push-Location -LiteralPath $root
      Get-ChildItem -Recurse -File -Force | ForEach-Object {
        [pscustomobject]@{
          Path = Resolve-Path -LiteralPath $_.FullName -Relative
          Hash = (Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash
        }
      }
      Pop-Location
    }
    Compare-Object (Get-Hashes 'C:\FolderA') (Get-Hashes 'D:\FolderB') -Property Path, Hash |
      Sort-Object Path

    No output means the folders are identical. A path listed once with <= is only in the first folder, once with => only in the second, and a path listed twice has different content. On our test pair it caught the silently changed file and the file inside the extra folder, and ignored the identical file with the different date. It reads every byte, so it is much slower than robocopy on large folders. More on the cmdlet in the Get-FileHash guide.

    A tool that does it for you

    • Small folders, no install: the free Folder Compare tool takes two folders (up to 100 files and 50 MB each), hashes them in memory on our server without storing them, and lists missing, added, and changed files.
    • Whole drives: FolderManifest is a desktop app for Windows 10/11, macOS, and Linux that compares two folders by SHA-256 on your own machine, shows the differences in both directions in one pass, and exports the result as an HTML, CSV, or Markdown report. It can also save a manifest of a folder and check the folder against it later.

    To be fair to robocopy: it is free, already installed, and the better tool for actually copying the differences once you know what they are. FolderManifest is paid after the trial and earns its place when you need proof by content rather than a size-and-date estimate. Other built-in options are covered in compare two folders on Windows.

    Frequently Asked Questions

    Can robocopy compare two folders without copying anything?

    Yes. Add the /L switch (list only): robocopy "C:\FolderA" "D:\FolderB" /L /E /NJH /NJS /NP /NDL. Robocopy prints what it would copy or flag and writes nothing. In our test both folders had the same files and timestamps before and after the run.

    What do New File, Newer, Older, Changed, and *EXTRA File mean?

    New File exists only in the first folder. Newer and Older exist in both, and the copy in the first folder has a later or earlier modified time. Changed has the same modified time but a different size. *EXTRA File exists only in the second folder.

    Does robocopy compare file contents or checksums?

    No. Robocopy compares file size and last-modified time only; it has no checksum or hash switch. A file whose content differs but whose size and timestamp match is treated as the same, and an identical file with a different timestamp is reported as Newer or Older.

    How do I list only the files missing from the second folder?

    Exclude every other class: robocopy "C:\FolderA" "D:\FolderB" /L /E /NJH /NJS /NP /NDL /XX /XC /XN /XO. /XX hides extra files, /XC hides changed, /XN hides newer and /XO hides older, so only New File lines remain.

    Is robocopy /MIR /L safe to run?

    Yes, as long as /L is present. /MIR /L only lists what a mirror would copy and delete. Remove /L and /MIR really deletes everything in the destination that the source does not have, so check the command twice before running it without /L.

    How do I save the robocopy comparison to a file?

    Add /LOG:"C:\compare.txt" to write the output to a text file, or /UNILOG:"C:\compare.txt" for Unicode file names. Add /TEE to see the output on screen as well. Use /LOG+: to append to an existing log.

    What exit code does robocopy return when the folders match?

    Exit code 0 means robocopy found nothing to copy and no extra files, by size and timestamp. Codes 1 to 7 mean it found differences, and 8 or higher means at least one error, such as a folder it could not read.

    Compare Folders by Content, Not by Date

    SHA-256 folder comparison, saved manifests, and shareable reports for Windows, macOS, and Linux. 7-day free trial, no card required, 30-day money-back guarantee.

    Continue Learning