New C. wrote in post #985925: > I have a got a few folders which may have same files under different > names. > Is there any way I can find which these files are using ruby ? Here is a little ruby script I use for finding and/or deleting duplicate image and video files downloaded from my camera - it will work for any sort of file. #!/usr/bin/ruby -w require 'digest/sha1' if ARGV[0] == "-d" do_delete = true ARGV.shift end seen = {} dirs = ARGV.empty? ? ["#{ENV["HOME"]}/Pictures"] : ARGV dirs.each do |dir| Dir["#{dir}/**/*"].sort.each do |fn| next if File.directory?(fn) hash = Digest::SHA1.file(fn).hexdigest if seen[hash] puts "#{fn} is dupe of #{seen[hash]}" if do_delete File.delete(fn) puts "DELETED" end else seen[hash] = fn end end end -- Posted via http://www.ruby-forum.com/.