Skip to content

Instantly share code, notes, and snippets.

@mctaylorpants
Last active February 28, 2020 18:47
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 mctaylorpants/04ceca3d4d0f7230c191d39e6462b4e5 to your computer and use it in GitHub Desktop.
Save mctaylorpants/04ceca3d4d0f7230c191d39e6462b4e5 to your computer and use it in GitHub Desktop.
Modify case-sensitive filenames on macOS
#!/usr/bin/env ruby
# Converts all characters in a filename to lowercase on macOS, where by default
# the filesystem is case-insensitive.
# Usage:
# Pass a glob pattern to the script:
# ruby downcase_filenames.rb spec/cassettes/**/*.yml
begin
`git config core.ignorecase false`
Dir[ARGV[0]].each do |cassette_file|
downcased_file = cassette_file.downcase
`git mv --force #{cassette_file} #{downcased_file}`
end
ensure
`git config core.ignorecase true`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment