Skip to content

Instantly share code, notes, and snippets.

@kch
Created October 19, 2010 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kch/635211 to your computer and use it in GitHub Desktop.
Save kch/635211 to your computer and use it in GitHub Desktop.
Rename files to all lowercase in two steps, works on a case-insensitive FS like HFS.
#!/usr/bin/env ruby
# encoding: UTF-8
require 'fileutils'
require 'unicode_utils'
ARGV.each do |f|
f_ = UnicodeUtils.downcase(f)
f__ = "#{f_}_#{rand}"
FileUtils.mv(f, f__)
FileUtils.mv(f__, f_)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment