Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

There's a great tool, fdupes, for finding duplicate files across two (or more) directories.

I'm looking for a simple tool/command that can output the complementary set - the paths of those files that do not have a duplicate.

share|improve this question
up vote 4 down vote accepted
find DIR1 DIR2 -type f -exec sha1sum '{}' \+ | sort | \
    uniq -c --check-chars 40 | egrep '^ *1 ' | cut -c 51-
share|improve this answer
Minor modification to use uniq functionality instead of grep: find DIR1 DIR2 -type f -exec sha1sum {} + | sort | uniq -u --check-chars 40 | cut -c 43- – Daniel Andersson May 20 '12 at 11:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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