Skip to content

Instantly share code, notes, and snippets.

View georgy7's full-sized avatar

Георгий У. georgy7

View GitHub Profile
@ma11hew28
ma11hew28 / find-duplicate-files.rb
Last active January 25, 2022 18:48
Ruby script that finds identical (md5) files in all subdirectories (recursive)
# This Ruby script (regardless of where it's located on the file system) recur-
# sively lists all duplicate files in the direcotry in which it's executed.
require 'digest/md5'
hash = {}
Dir.glob('**/*', File::FNM_DOTMATCH).each do |f|
next if File.directory?(f)
key = Digest::MD5.hexdigest(IO.read(f)).to_sym