This commit is contained in:
KlzXS 2020-11-08 11:28:28 +00:00
parent d4c1986a95
commit 81953dd571
No known key found for this signature in database
GPG key ID: FF9B81B098D5BACA

View file

@ -24,7 +24,7 @@ printf "\
## This is an overview of all duplicate files found. ## This is an overview of all duplicate files found.
## After editiing this file you will be prompted to remove some of them. ## After editiing this file you will be prompted to remove some of them.
## You can choose between removing all the commented out files, all the uncommented ones or none at all. ## You can choose between removing all the commented out files, all the uncommented ones or none at all.
## All the lines begining with '##','#md5sum' or 'md5sum' will be ignored either way. ## Lines with double comments (##) are always ignored.
## If you choose to remove, you will be given a choice between removing with force or interactively for each file.\n ## If you choose to remove, you will be given a choice between removing with force or interactively for each file.\n
" > "$tmpfile" " > "$tmpfile"
@ -33,7 +33,7 @@ find . -size +0 -type f -printf "%${size_digits}s %p\n" | sort -rn | uniq -w"${s
s/^ {,12}([0-9]{,12}) (.*)$/printf "%s %s\\n" "$(md5sum "\2")" "d\1"/ s/^ {,12}([0-9]{,12}) (.*)$/printf "%s %s\\n" "$(md5sum "\2")" "d\1"/
' | tr '\n' '\0' | xargs -0 -n1 sh -c | sort | { uniq -w32 --all-repeated=separate; echo; } | sed -nE ' ' | tr '\n' '\0' | xargs -0 -n1 sh -c | sort | { uniq -w32 --all-repeated=separate; echo; } | sed -nE '
h h
s/^(.{32}).* d([0-9]*)$/#md5sum: \1 size: \2 bytes/p s/^(.{32}).* d([0-9]*)$/## md5sum: \1 size: \2 bytes/p
g g
:loop :loop
@ -47,9 +47,9 @@ printf "Remove commented files? (yes/no/abort) [default=a]: "
read -r commented read -r commented
if [ "$commented" = "y" ]; then if [ "$commented" = "y" ]; then
sedcmd="/^(##|#?md5sum|[^#]).*/d; /^$/d; s/^# *(.*)$/\1/" sedcmd="/^(##|[^#]).*/d; /^$/d; s/^# *(.*)$/\1/"
elif [ "$commented" = "n" ]; then elif [ "$commented" = "n" ]; then
sedcmd="/^(#|#?md5sum).*/d; /^$/d; s/^ *(.*)$/\1/" sedcmd="/^#.*/d; /^$/d; s/^ *(.*)$/\1/"
else else
printf "Press any key to exit" printf "Press any key to exit"
read -r _ read -r _