]> Sergey Matveev's repositories - nnn.git/commitdiff
Optimize dups (#539)
authorKlzXS <azszwymmvqdi@yahoo.com>
Sun, 26 Apr 2020 16:55:03 +0000 (18:55 +0200)
committerGitHub <noreply@github.com>
Sun, 26 Apr 2020 16:55:03 +0000 (22:25 +0530)
plugins/dups

index 2c5bb5ecefca9a2be3663380aa15d2d817a68aa6..c35489c6ddd7f72136fa06ba7462f69f572bc58f 100755 (executable)
@@ -7,9 +7,9 @@
 # Requires: find md5sum sort uniq xargs
 #
 # Shell: POSIX compliant
-# Author: syssyphus
+# Author: syssyphus, KlzXS
 
-find . -size +0 -type f -printf "%s\n" | sort -rn | uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate
+find . -size +0 -type f -printf "%s %p\n" | sort -rn | sed -n 'N; /^\([0-9]*\) .*\n\1.*$/p;$d;D' | awk '{printf("%s\0", substr($0, index($0, $2)))}' | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate
 
 printf "Press any key to exit"
 read -r _