From d12dbee1fd5261beac86f9563fe8fe5b3deedb94 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 5 Jul 2017 09:19:33 +0200 Subject: duplicates: bugfix --- duplicates | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'duplicates') 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 -- cgit v1.2.3