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

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

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

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