summaryrefslogtreecommitdiff
path: root/duplicates
blob: 5a92348f2b76d96b22d411d494cfe6d1e545f992 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env ruby

dir = ARGV[0]
a = `find #{dir} -type f`.split "\n"

hashcmd = "sha1sum"

h = {}
a.each { |fn|
  hash = `#{hashcmd} "#{fn}" | cut -d " " -f1`.strip
  if h.has_key? hash
    h[hash] << fn
  else
    h[hash] = [fn]
  end
}

h.each { |k,v|
  v.sort!
  if v.size > 1
    puts k
    v.each { |i| puts "\t#{i}" }
    puts
  end
}