Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

So, on Windows (XP, Vista), is there any command (builtin dos command) or any 3rd party tool/utility (commercial or freeware - either) to compare two folders using command line?

share|improve this question

5 Answers 5

up vote 2 down vote accepted

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

share|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.

share|improve this answer

The comp suggestion by William is great for a simple compare.
Limitations of the command line interface make it hard to analyze the results of the comparison so I suggest redirecting the output of the commands to a file like:
comp c:\temp\1 c:\temp\2 >> results1.txt
comp c:\temp\2 c:\temp\1 >> results2.txt

share|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.

share|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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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