add script to find identical files
[www.git] / src / tricks / find_same_files.sh
diff --git a/src/tricks/find_same_files.sh b/src/tricks/find_same_files.sh
new file mode 100755 (executable)
index 0000000..a1f48ae
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+# Find same files in a given directory
+
+set -e
+
+if [ -z "$1" ]; then
+  SDIR="."
+else
+  SDIR="$1"
+fi
+
+find "$SDIR" -type f -exec md5sum {} \; | sort -n | uniq -w32 -D