Skip to content

Instantly share code, notes, and snippets.

@sushain97
Created August 20, 2014 22:03
Show Gist options
  • Save sushain97/b6d30ee9673885ddaa76 to your computer and use it in GitHub Desktop.
Save sushain97/b6d30ee9673885ddaa76 to your computer and use it in GitHub Desktop.
require "Digest"
require "pp"
files = Dir.entries("#{ARGV.first}").select { |f| !File.directory? "#{ARGV.first}#{f}" }
filehashes = Hash[files.map { |f| [f, Digest::MD5.file("#{ARGV.first}#{f}").hexdigest] }]
grouped = filehashes.group_by{ |k, v| v }.keep_if{ |_, e| e.length > 1 }
PP.pp(grouped)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment