summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2017-07-05 09:19:33 +0200
committerPatrick Simianer <p@simianer.de>2017-07-05 09:19:33 +0200
commitd12dbee1fd5261beac86f9563fe8fe5b3deedb94 (patch)
tree8ba94767eded44678c01ef6c825356fcd9c55b73
parenta2a68fa25e257a3b8b2c93235c51ad8b37bd63ba (diff)
duplicates: bugfix
-rwxr-xr-xduplicates10
1 files changed, 8 insertions, 2 deletions
diff --git a/duplicates b/duplicates
index 208432a..a907114 100755
--- a/duplicates
+++ b/duplicates
@@ -4,13 +4,19 @@ dir = ARGV[0]
a = `find #{dir} -type f`.split "\n"
md5cmd = "md5sum"
-if `uname`.strip == "Darwin"
+os = `uname`.strip
+if os == "Darwin"
md5cmd = "md5"
end
h = {}
a.each { |fn|
- md5 = `#{md5cmd} "#{fn}" | cut -d " " -f1`
+ if os == "Darwin"
+ md5 = `#{md5cmd} "#{fn}" | cut -d "=" -f2`.lstrip.strip
+ else
+ md5 = `#{md5cmd} "#{fn}" | cut -d " " -f1`.strip
+ end
+ puts md5
if h.has_key? md5
h[md5] << fn
else