Created
July 9, 2012 21:32
-
-
Save equivalent/3079116 to your computer and use it in GitHub Desktop.
Script to rename files in folders (Sketchup animation render)
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
source 'https://rubygems.org' | |
gem 'bundler' | |
gem 'rb-readline' |
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
task :rename do | |
folder_path = "/media/usbdevise/folder/" | |
i = 0 | |
Dir.glob(folder_path + "*").sort.each do |f| | |
i = i + 1 | |
new_name = "%08d" % i | |
File.rename(f, folder_path + new_name + File.extname(f)) | |
#p folder_path + new_name + File.extname(f) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just simple script for my girlfriend to rename her rendered animation images... This is when you create animation with Google Sketchup on several scenes. For some reason Sketchup starts naming each scene image 0079.0001.png , insted of 0080.png . Script will just sort named files and rename them in order
will rename to