Fog Creek Software
Discussion Board




Folder compare utitily


I have two copies of a folder that has about 8 GB of size total and a couple of thousands of (binary) files. Both  folders (the original and a copy) are in the same machine (Windows XP Professional). Using the folder properties dialog, I can see that there is a diference of 10 files that are missing in the copy folder.

The problem is: I need to know what files are missing in the copy folder. Do you know if Windows XP or VisualStudio (VS 6 or VS.Net) have any utility that would do the trick?. If not, any third-party tool? This is a one time task, so I don’t mind if it is not a fully automated process (I would like to see If I can do it without coding).

I already tried windiff, but it does not only compare folder structures, but also file contents, and it's taking a lot of time (I started it and it looked like it was going to take several hours).

I want to compare all the tree structure including files, don’t care abour file contents.

Thank you very much in advance..

The one who should be doing other things
Thursday, June 12, 2003

dir /s /b folder1 > folder1.txt
dir /s /b folder2 > folder2.txt
massage the two (w/a perl script, etc)
windiff folder1.txt folder2.txt

does not compare file sizes, you can omit the /b for that.

mb
Thursday, June 12, 2003

I am not very proficien with perl.. but I am sure a perl script will do it.

I'll post it if I find one or come up with one.

The one who should be doing other things
Thursday, June 12, 2003

MB,  Very good idea,

that will do the trick

thanks again

The one who should be doing other things
Thursday, June 12, 2003

I think examdiff does this. There are a million free diff utilities - some compare only two files, others can compare directories / subdirectories.

Check download.com or google for diff utilties.

www.MarkTAW.com
Thursday, June 12, 2003

I don't think you need a perl script or any special tools.  How about this:

dir /ON /B folder1 > f1.txt
dir /ON /B folder2 > f2.txt
fc f1.txt f2.txt

Just did a quick test and it seems to work.  Note:
/ON sorts (/O) by name (N).
fc is the built in windows File Compare.

cheers,
Peter

Peter McKenzie
Thursday, June 12, 2003

Oops, it seems you're after subdirectories as well in which case you'll need /s and some munging as pointed out by mb.

Peter McKenzie
Thursday, June 12, 2003

Mark, I knew I should have first searched the net (and in fact I did).

I posted the topic because I had the feeling that there was some very simple way to do it with the standard windows tools, and thought that some people here could came with interesting suggestions.

I don't mean to say that I don't appreciate your answer, or that I don´t think it was useful. thanks.

The one who should be doing other things
Thursday, June 12, 2003

> I knew I should have first searched the net (and in fact I did).

I've seen a few posts here where the person simply didn't know WHAT to search for, so I thought if I introduced the word "diff" so you could search for that. =)

I'm enough of a geek to want to run a regex on some plaintext I got from a dir, but not enough of one to do it in perl. If there's a .exe that can do it for me, I'm all for it.

I guess that's difference between programmers and laymen... programmers think "how can I do this in perl."

Mark Wieczorek
Thursday, June 12, 2003

actually no perl is required for my solution, it uses windiff.
you can use notepad, and I probably would for a one-off. all it is is replace 'c:\path\to\dir1' with '' on file1 and replace 'd:\other\path2' with '' on file2.

the /on is probably useful...

mb
Thursday, June 12, 2003

Use ROBOCOPY it is a utility that came with the NT4 resource kit...I use it as a poor man's replication tool. Look for it on google and you will find it somewhere. It is a free utility.

Joel Sundquist
Thursday, June 12, 2003

I finally eded up with:

c:\dir1:> dir /on /b /s > file1.txt
c:\dir2:> dir /on /b /s > file2.txt

Replaced 'c:\dir1\' and c:\dir2\ with an empty string in both files.

And the perl script:

open FILE1, "<file1.txt"; @linesFile1 = <FILE1>; close FILE1;
open FILE2, "<file2.txt"; @linesFile2 = <FILE2>; close FILE2;

foreach $line(@linesFile1)
{
    if(! grep{$_ eq $line} @linesFile2 ){ print "Not found: $line\n"; }
}

I simply could not have the windiff to work. The output was always kind of messy for no reason :(

The one who should be doing other things
Thursday, June 12, 2003

And fc.exe was just like:

'Resync Failed.  Files are too different.'

:(

The one who should be doing other things
Thursday, June 12, 2003

find . -type d -exec diff --brief {} otherdir/{} \;

Peace o' cake
Thursday, June 12, 2003

I should probably verify before I post, but I'm pretty sure that Beyond Compare does this: http://www.scootersoftware.com/ .

Troy King
Thursday, June 12, 2003

Beyond Compare is great. Araxis Merge might be better, but it's way more expensive.

www.MarkTAW.com
Thursday, June 12, 2003

You all like to complicate it, don't you?
Just use Windows Commander or Total Commander (same thing), even if it's a trial version. Go to Commands menu / Synchronize Dirs, on the left side select the original folder, on the other side select its copy, check the Subdirs checkbox and press Compare. You even have option to see unequal files  beside the missing ones.
That's all folks!

Lacko
Friday, June 13, 2003

Now I've never taken it to these lengths, but codewarrior has a great folder compare option.  Even an eval copy of codewarrior should have it in.

i like i
Friday, June 13, 2003

Beyond Compare is fantastic!! One of those utilities I can't remember how I ever did without.

In this case it will show you which files only exist in either folder and effortlessly let you copy the discrepencies one way ot the other.

Ant
Friday, June 13, 2003

Another vote for Beyond Compare, it really is.

Ged Byrne
Friday, June 13, 2003

Go grab Unison for a free file synchornizer:
http://www.cis.upenn.edu/~bcpierce/unison/

Ryan Mitchell
Friday, June 13, 2003

I've had good luck with FileSync (http://www.fileware.co.uk/products.htm#FileSync)

Matt Christensen
Friday, June 13, 2003

don't need a perl script to comapre fed them into access as two seperate tables and do an outer join

Daniel Shchyokin
Friday, June 13, 2003

The perl script is one line of code (aside opening the files)
Using two tables would requiere creating the database structure, and performing the query.. I feel it is more complicated.

But its a great idea also.

I think it depends exactly on what are you trying to achieve.

The one who should be doing other things
Friday, June 13, 2003

You were so dam right!

Beyond Compare is the way to go.

thansk again

The one who should be doing other things
Friday, June 13, 2003

*  Recent Topics

*  Fog Creek Home