#!/bin/sh md5sum * > /tmp/md5.txt sort /tmp/md5.txt > /tmp/mdd5.txt rm -f /tmp/md5.txt pmd= pfn= cat /tmp/mdd5.txt | while read md fn; do if [ "$md" = "" ]; then break; fi if [ "$pmd" != "" ]; then if [ "$pmd" = "$md" ]; then rm -f "$fn" fi fi pmd=$md pfn=$fn done
#!/bin/sh for f in *; do if [ -f "$1/$f" ]; then a=`md5sum "$f" | awk '{print $1}'` b=`md5sum "$1/$f" | awk '{print $1}'` if [ "$a" == "$b" ]; then echo "del $1/$f" rm -f "$1/$f" fi fi done