Skip to content

Instantly share code, notes, and snippets.

@wteuber
Created April 29, 2015 08:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wteuber/363c24b3a446b23603c5 to your computer and use it in GitHub Desktop.
Save wteuber/363c24b3a446b23603c5 to your computer and use it in GitHub Desktop.
find equal files recursively
require 'digest'
result = Hash.new() { |hash, key| hash[key] = [] }
Dir['**/*'].each do |file|
if File.file?(file)
result[Digest::MD5.new.file(file).to_s] << file
end
end
result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment