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/md5' | |
hash = {} | |
Dir.glob("**/*", File::FNM_DOTMATCH).each do |filename| | |
next if File.directory?(filename) | |
# puts 'Checking ' + filename | |
key = Digest::MD5.hexdigest(IO.read(filename)).to_sym | |
if hash.has_key? key |
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
#!/usr/bin/env ruby | |
# NOTE current directory is assumed | |
# NOTE run with 'rm {}' to remove duplicate copies (while taking necessary caution) | |
exec_command = ARGV[0] || 'echo {}' | |
require 'digest/md5' | |
require 'shellwords' | |
filenames_by_md5 = {} |