Tag Archives: snippet

Show Duplicate Filenames with Ruby

Here’s a quick one. I want to show just the names of files that have the same basename in a directory. Code require ‘find’ require ‘set’ all_files  = [] duplicates = {} basenames  = Set.new ARGV.each do |dir|   Find.find … Continue reading

Posted in ruby | Tagged , , , | Leave a comment

Sanitizing File Names with Ruby

At work, I ran into a problem wherein I was copying files from one filesystem (FAT32) to another (NTFS), and there were file names with characters that were legal in the first, but not the second. I wrote a Ruby … Continue reading

Posted in ruby, scripts | Tagged , , , , , | Leave a comment