17 lines
312 B
Bash
Executable File
17 lines
312 B
Bash
Executable File
#!/bin/sh
|
|
depth="-maxdepth 1"
|
|
case "$1" in
|
|
-r|--recursive) depth="" ;;
|
|
-h|--help)
|
|
echo "Usage: $(basename "$0") [-r]"
|
|
echo " -r, --recursive search subdirectories too"
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
find . $depth -type f -exec md5sum {} + | sort | awk '{
|
|
if ($1 == prev) print "rm " $2
|
|
prev = $1
|
|
}'
|
|
|