Created
April 4, 2014 13:46
-
-
Save wilbert/9975022 to your computer and use it in GitHub Desktop.
Parameterieze file names from folder
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
folder_path = "/Users/wilbert/Desktop/files" | |
Dir.foreach(folder_path) do |item| | |
next if item == '.' or item == '..' | |
filename = File.basename(item, File.extname(item)) | |
File.rename(folder_path + "/" + item, folder_path + "/" + filename.gsub(" ", "-").downcase + File.extname(item)) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment