Add shell-equivalent as an executable script
[dups.git] / dups.sh
diff --git a/dups.sh b/dups.sh
new file mode 100755 (executable)
index 0000000..bd282e5
--- /dev/null
+++ b/dups.sh
@@ -0,0 +1,23 @@
+#! /bin/sh
+
+find $@ -type f -print0 \
+| xargs -0 -P $(nproc) md5sum \
+| awk '
+    {
+        digest = $1
+        sub("^" $1 " +", "")
+        path = $0
+        paths[digest, ++count[digest]] = path
+    }
+
+    END {
+        for (digest in count) {
+            n = count[digest]
+            if (n > 1) {
+                print(digest, n)
+                for (i=1; i<=n; i++) {
+                    printf "    %s\n", paths[digest, i]
+                }
+            }
+        }
+    }'
This page took 0.017537 seconds and 4 git commands to generate.