add script to find identical files
authorJean-Philippe Orsini <jeanfi@gmail.com>
Thu, 8 Jun 2017 00:20:29 +0000 (02:20 +0200)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Thu, 8 Jun 2017 00:20:29 +0000 (02:20 +0200)
src/tricks/find_same_files.sh [new file with mode: 0755]

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