#!/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 }