It looks pretty obfuscated to my eyes, but each to his own.

dirs.each do |dir|
  Dir["#{dir}/**/*"].sort.each do |fn|
    next if File.directory?(fn)
    hash = Digest::SHA1.file(fn).hexdigest
    if seen.fetch(hash) { seen[hash]=fn; false }
      puts "#{fn} is dupe of #{seen[hash]}"
      if do_delete
        File.delete(fn)
        puts "DELETED"
      end
    end
  end
end

-- 
Posted via http://www.ruby-forum.com/.