Created
April 29, 2015 08:27
-
-
Save wteuber/363c24b3a446b23603c5 to your computer and use it in GitHub Desktop.
find equal files recursively
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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