1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
#!/bin/sh -
#
# finddup 1.00 - find identical files.
#
# Oleg Kibirev * April 1995 * oleg@gd.cs.CSUFresno.EDU
#
# This code is covered by General Public License, version 2 or any later
# version of your choice. You should recieve file "COPYING" which contains
# text of the license with any distribution of this program; if you don't
# have it, a copy is available from ftp.gnu.ai.mit.edu.
#
find . -xdev -type f -printf "%p %i\n" |
egrep "^[[:punct:][:alnum:]]+ [[:digit:]]+$" |
sort +1 |
uniq -1 |
cut -f 1 -d ' ' |
xargs md5sum |
sort +0 -1 |
(
psum='x'
line=''
many=''
while read sum file; do
if [ "$sum" != "$psum" ]; then
if [ ! -z "$many" ]; then
set x $line
k="`du $2`"
shift 2
echo $k "$@"
fi
line="$file"
psum="$sum"
many=''
else
line="$line $file"
many=yes
fi
done
if [ ! -z "$many" ]; then
set x $line
k="`du $2`"
shift 2
echo $k "$@"
fi
) | sort +0 -1 -r -n
|