Created
April 15, 2015 04:42
-
-
Save ihower/593611ffa5cedc6d8409 to your computer and use it in GitHub Desktop.
ruby rename files
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
target = "@2x" | |
Dir.glob("*.png").sort.each do |entry| | |
if File.basename(entry, File.extname(entry)).include?(target) | |
newEntry = entry.gsub(target, "") | |
File.rename( entry, newEntry ) | |
puts "Rename from " + entry + " to " + newEntry | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment