Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ihower
Created April 15, 2015 04:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ihower/593611ffa5cedc6d8409 to your computer and use it in GitHub Desktop.
Save ihower/593611ffa5cedc6d8409 to your computer and use it in GitHub Desktop.
ruby rename files
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