Removing files with varied capitalization
Nothing ground-breaking today, just a one-liner that I expected to be longer than a one-liner.
# Remove Rakefile, rakefile, RakeFile, etc...
File.delete(*Dir.glob('rakefile', File::FNM_CASEFOLD))
There are two notable things going on here:
Dir.globcan take optional bitflags; in this case,FNM_CASEFOLDmeans to ignore case.File.deletecan take N arguments.

This work, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.
Related posts:
