up vote 1 down vote favorite
share [g+] share [fb]

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?

link|improve this question

57% accept rate
feedback

3 Answers

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.

link|improve this answer
feedback

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.

link|improve this answer
feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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