diff options
author | KlzXS <azszwymmvqdi@yahoo.com> | 2020-10-21 17:37:33 +0000 |
---|---|---|
committer | KlzXS <azszwymmvqdi@yahoo.com> | 2020-10-21 17:46:31 +0000 |
commit | afdba193e47b5413962f2fc56e28e9e8947be955 (patch) | |
tree | 4443115c2dee7a74d6a9ef6fd40e03e8c1167052 | |
parent | 782df96080a397d9bccc20fd023c692f86d79371 (diff) | |
download | nnn-afdba193e47b5413962f2fc56e28e9e8947be955.tar.gz |
Fix filenames with spaces not working
-rwxr-xr-x | plugins/dups | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/dups b/plugins/dups index aef3923..7ce405c 100755 --- a/plugins/dups +++ b/plugins/dups @@ -21,7 +21,9 @@ size_digits=12 tmpfile=$(mktemp "$TMPDIR/.nnnXXXXXX") # shellcheck disable=SC2016 -find . -size +0 -type f -printf "%${size_digits}s %p\n" | sort -rn | uniq -w"${size_digits}" -D | tr '\n' '\0' | xargs -0 -n1 sh -c 'printf "%s %s\n" "$(md5sum $@)" "d$0"' | sort | { uniq -w32 --all-repeated=separate; echo; } | sed -nE ' +find . -size +0 -type f -printf "%${size_digits}s %p\n" | sort -rn | uniq -w"${size_digits}" -D | sed -E ' +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 ' h s/^(.{32}).* d([0-9]*)$/md5sum: \1 size: \2 bytes/p g @@ -36,7 +38,7 @@ p' | sed -E 's/^.{32} (.*) d[0-9]*$/\1/' > "$tmpfile" cat "$tmpfile" # shellcheck disable=SC2016 -sed -e 's/md5sum.*//' "$tmpfile" | tr '\n' '\0' | xargs -0 sh -c 'rm -i $0 $@ < /dev/tty' +sed -e 's/md5sum.*//' "$tmpfile" | tr '\n' '\0' | xargs -0 sh -c 'rm -i "$0" "$@" < /dev/tty' rm "$tmpfile" |