Last active
July 18, 2020 16:31
-
-
Save ianneub/e212c0ba1735c6f338c7301c4b093b77 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
require 'fileutils' | |
Dir['test/**.jpg'].each do |f| | |
dirname = File.dirname(f) | |
filename = File.basename(f) | |
new_filename = filename.gsub(/IMG_([0-9]+)/, "reU-") | |
puts "#{dirname}/#{filename} => #{dirname}/#{new_filename}" | |
FileUtils.mv "#{dirname}/#{filename}", "#{dirname}/#{new_filename}" | |
end |
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
Dir['test/**.jpg'].each do |f| | |
filename = File.basename(f) | |
new_filename = filename.gsub(/IMG_([0-9]+)/, "reU-") | |
puts "#{filename} => #{new_filename}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment