diff options
author | Patrick Simianer <p@simianer.de> | 2017-07-05 09:19:33 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2017-07-05 09:19:33 +0200 |
commit | d12dbee1fd5261beac86f9563fe8fe5b3deedb94 (patch) | |
tree | 8ba94767eded44678c01ef6c825356fcd9c55b73 | |
parent | a2a68fa25e257a3b8b2c93235c51ad8b37bd63ba (diff) |
duplicates: bugfix
-rwxr-xr-x | duplicates | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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 |