Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .