Created
June 30, 2015 19:51
-
-
Save denysxftr/3b9e72e714386e7fcdeb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
folder_path = ENV['FOLDER'] | |
from = Regexp.new(ENV['FROM']) | |
to = ENV['TO'] | |
Dir.glob(folder_path + "*").sort.each do |f| | |
filename = File.basename(f, File.extname(f)) | |
new_filename = filename.gsub(from, to) | |
File.rename(f, folder_path + new_filename + File.extname(f)) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment