I am using OSX 10.8.4 and would like to remove duplicate files in a single flat directory if an md5 hash matches.
I have looked up several answers but none of them work for me, I think because of differences in command syntax between terminal versions.
Things I have tried:
http://www.chriswrites.com/2012/02/how-to-find-and-delete-duplicate-files-in-mac-os-x/
Finding and removing duplicate files in osx with a script
and some of these: http://www.commandlinefu.com/commands/view/3555/find-duplicate-files-based-on-size-first-then-md5-hash#comment
This approach feels closest:
find . -size 20 \! -type d -exec cksum {} \; | sort | tee /tmp/f.tmp | cut -f 1,2 -d ' ' | uniq -d | grep -hif - /tmp/f.tmp > duplicates.txt
But I get an error: grep: -: No such file or directory
Upon inspection, /tmp/f.tmp does exist. The duplicates.txt file is created but is empty.
How do I deduplicate these files?