Skip to content

Instantly share code, notes, and snippets.

@therod
Created November 3, 2016 18:36
Show Gist options
  • Save therod/36f3c4595b7fd5d2991f29df0b14dd26 to your computer and use it in GitHub Desktop.
Save therod/36f3c4595b7fd5d2991f29df0b14dd26 to your computer and use it in GitHub Desktop.
Simple script that normalizes files in a folder and renames them accordingly
require 'i18n'
require 'fileutils'
I18n.available_locales = [:en]
Dir.glob('./authors/*.jpg').map do |orig|
dest = I18n.transliterate(orig.downcase.tr(' ', '-').tr('_', '-'))
File.rename(orig, dest)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment