Created
May 27, 2011 11:23
-
-
Save aj-justo/995067 to your computer and use it in GitHub Desktop.
Rename images with given pattern
This file contains 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
path = 'images/' | |
imgDir = Dir.new(path) | |
imgs = imgDir.entries | |
imgs.each do |i| | |
if i=='.' or i=='..' then next end | |
newfile = i.gsub(/([^.]+\.[^.]+\.[^.]+)\.00.jpg/i, '\\1.jpg') | |
File.rename(path+i, path+newfile) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment