summaryrefslogtreecommitdiff
path: root/dup
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-08-10 11:19:38 +0100
committerPatrick Simianer <p@simianer.de>2014-08-10 11:19:38 +0100
commit5869505d64c04c536bdcd71a197ade918c36bf1c (patch)
tree6af5232a9f2e058f15230a370a960f89871a2b74 /dup
init
Diffstat (limited to 'dup')
-rwxr-xr-xdup24
1 files changed, 24 insertions, 0 deletions
diff --git a/dup b/dup
new file mode 100755
index 0000000..3809c16
--- /dev/null
+++ b/dup
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+
+
+dir = ARGV[0]
+a = `find #{dir} -type f`.split "\n"
+
+h = {}
+a.each { |fn|
+ md5 = `md5sum "#{fn}" | cut -d " " -f1`
+ if h.has_key? md5
+ h[md5] << fn
+ else
+ h[md5] = [fn]
+ end
+}
+
+h.each { |k,v|
+ if v.size > 1
+ puts k
+ v.each { |i| puts "\t#{i}" }
+ puts
+ end
+}
+