summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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