Skip to content

Instantly share code, notes, and snippets.

Created June 24, 2014 22:58
Show Gist options
  • Save anonymous/1f1ff37c39bd20c9d666 to your computer and use it in GitHub Desktop.
Save anonymous/1f1ff37c39bd20c9d666 to your computer and use it in GitHub Desktop.
fdups - Find file duplicates in given path(s) or current working directory
#! /bin/sh
fdups1()
{
find "${1:-.}" -type f -printf '%s\n' |
sort -n |
uniq -d |
xargs -I@@ -n1 find "${1:-.}" -type f -size @@c -exec md5sum {} \; |
sort -k1,32 |
uniq -w32 -d --all-repeated=separate |
sed 's/^[^ ]\+ \+//'
}
for path
do
fdups1 "$path"
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment