I want to compare two folders on Windows (Vista, XP) which have large number of huge files. If I use Beyond Compare or such tool to compare the folders, it is taking a lot of time if I do it manually. I need to add that folder comparison command to a batch file.

So, on Windows (XP, Vista) is there any command, or any 3rd party tool/utility that runs under CMD.EXE (commercial or freeware), to compare two folders?


Try robocopy with the /mir (mirror) and /L flags. The /L tells it to list the files without really doing the work.

| improve this answer | |

If you just want a very quick yes/no using built in tools, use the "comp" command

It is an old command and it is really only designed for individual files, but it works well - you will need to run it twice as it will only compare for files it can find:

This will compare all files in c:\temp\1 against c:\temp\2, then in reverse:

comp c:\temp\1 c:\temp\2
comp c:\temp\2 c:\temp\1

If a file is in one location but not another, you will see: "Can't open file: c:\temp\2\bla.txt"

If a file is different, it will report it as such, for example "Files are different sizes."

If everything checks out, it will say "Files compare OK".

The reason for running this twice is that it will only check and compare files in the second location that it found in the first, so by running it twice, you search both locations for any files that may only be in one folder.

| improve this answer | |

Beyond Compare can be executed from a script; its command-line syntax is extensive. I don't think every single feature in the UI is provided from the command line, but certainly everything you'd need, I think.

| improve this answer | |
BCompare.exe @bcscript.txt  f:\file1.txt  f:\file2.txt  f:\file1and2compare.html

I wrote a batch script where I have changed only the file name of 1, 2 and output filename according to my need.

The contents of bcscript are as follows:

text-report layout:side-by-side  options:line-numbers &
output-to:"%3" &
output-options:html-color "%1" "%2"

For more info check out this blog post.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.