Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- require 'digest'
- paths = ARGV.map{|v| Dir[v]}.flatten.uniq
- def codehash(path)
- Digest::MD5.hexdigest(File.read(path).gsub(/[\s;<>"]/,'').downcase)
- end
- hashes = {}
- # calc code hash
- paths.each do |path|
- hash = codehash(path)
- hashes[hash] ||= []
- hashes[hash] << path
- end
- # ouput duplicated
- hashes.select {|k,v| v.size > 1}.each do |k, v|
- puts v.join("\t")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement