#! /bin/bash
OUTF=rem-duplicates.txt;
OUTF2=rem-duplicates.sh;
find "$@" -type f -print0 | xargs -0 -n1 md5sum | sort --key=1,32 | uniq -w 32 -d --all-repeated=separate > $OUTF

echo "#! /bin/bash" > $OUTF2;
echo "" >> $OUTF2;
cat $OUTF | sed -r 's/^[0-9a-f]*( )*//;s/([^a-zA-Z0-9./_-])/\\\1/g;s/(.+)/#rm \1/' >> $OUTF2;
chmod a+x $OUTF2;
