Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Compare directories via diff' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Compare directories via diff
Authored by: mzso on Apr 10, '07 03:16:41PM

Some time ago I was looking for a tool to binary-compare two directories too. Diff is a bit of an overkill in this case since I was not interested in the details of differences between the two dir structures, I just wanted to know whether they're the same or not.

I've found only one GUI application that would satisfy my needs, it was Kdiff3. However there's a lot more simple and elegant solution. :-) Start a shell and enter the dir that you want to compare with another, then run a "find":

cd /path/to/dir1
find . -type f -not -exec cmp {} /path/to/dir2/{} ";" -print

This will print the name of each file that differs between the two directories.



[ Reply to This | # ]
Compare directories via diff
Authored by: LC on Apr 17, '07 08:14:03PM

It seems to me that any items uniquely found in dir2 won't be reported by the find command.



[ Reply to This | # ]
Compare directories via diff
Authored by: SoYman on Jul 10, '13 06:18:14AM

make sure to format this command exactly the same and including these: " " when needed

find . -type f -not -exec cmp {} /path/to/dir2/{} ";" -print


I really just wanted to thank you and everyone in this thread. Relocating and cleaning up my mothers age old backup folder that is filled with duplicates has been made so much easier.

You have all my grattitudes.



[ Reply to This | # ]