Skip to content

Instantly share code, notes, and snippets.

@jdjkelly
Created March 21, 2012 14:24
Show Gist options
  • Save jdjkelly/2147339 to your computer and use it in GitHub Desktop.
Save jdjkelly/2147339 to your computer and use it in GitHub Desktop.
Bulk Ruby File Renaming
require 'fileutils'
filenames = Dir.glob("*.jpg")
filenames.each do |filename|
File.rename(filename, filename.gsub(/.jpg/, '') + "fr.jpg")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment