I have two directories and I'm sure there are duplicate files, but I need to confirm. We're talking about hundreds of files here, and I know some files exist in one directory but not in the other. I'm looking for a quick way to compare the file names and sizes in both directories. Ideally, I want a method that will show me files that share the same name but differ in size, as well as files that are present in one directory but missing in the other.
5 Answers
You might want to try `rsync -avn /dir1 /dir2`. Just remember to include the `-n`, so it runs in dry-run mode. It’s also a good idea to look into the manual for instructions on using the trailing slash (it can be confusing!). For an added layer of checking, you can include `-c` to compare checksums.
What about this command? `diff <(cd dir1; du -s * | sort -n) <(cd dir2; du -s * | sort -n)`—it should help you with what you're looking for.
I've had a lot of success using checksums for this sort of comparison. I’ve got a script lying around; if nobody else posts it, I'll share what I can later!
An alternative you could use is `diff -rq /dir1 /dir2`. It's pretty effective and can be faster than `rsync`, depending on what you need. Definitely give it a shot!
You could also try a version of `find -exec md5sum | sort | uniq -c`. There are tools like fdupes and jdupes that work really well too, especially jdupes for larger collections since it’s pretty fast.

Related Questions
XML Signature Verifier
Voltage Divider Calculator
SSL Certificate Decoder
SQL Formatter
Online Font Playground to Test Google or Custom Fonts
File Hash Generator Online – Get Instant MD5 and SHA-256 Hashes