summaryrefslogtreecommitdiff
path: root/duplicates
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2017-04-02 23:04:30 +0200
committerPatrick Simianer <p@simianer.de>2017-04-02 23:04:30 +0200
commite981dd753d99527884684509b88577a7b1f12997 (patch)
tree906c15364e385f073836fb9ba8d19fdc61b8dde7 /duplicates
parentc5589d1625c26489b7a26f2bdab06b5a05513107 (diff)
duplicates: macos compat
Diffstat (limited to 'duplicates')
-rwxr-xr-xduplicates7
1 files changed, 6 insertions, 1 deletions
diff --git a/duplicates b/duplicates
index 82e72bd..8be99f9 100755
--- a/duplicates
+++ b/duplicates
@@ -3,9 +3,14 @@
dir = ARGV[0]
a = `find #{dir} -type f`.split "\n"
+md5 = "md5sum"
+if `uname` == "Darwin"
+ md5 = "md5"
+end
+
h = {}
a.each { |fn|
- md5 = `md5sum "#{fn}" | cut -d " " -f1`
+ md5 = `#{md5} "#{fn}" | cut -d " " -f1`
if h.has_key? md5
h[md5] << fn
else