Last active
May 30, 2016 12:49
Revisions
-
randy909 revised this gist
May 30, 2016 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ Dir.glob('*.{mp3,MP3}') do |file| match = file.match(/^(.+\()(\d+)(\).+)/) if (match == nil) puts "skipping #{file}" @@ -11,3 +11,4 @@ File.rename(file, newfile) end -
randy909 revised this gist
May 30, 2016 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,13 @@ Dir.glob('*.mp3') do |file| match = file.match(/^(.+\()(\d+)(\).+)/) if (match == nil) puts "skipping #{file}" next end front, num, back = match.captures num = num.rjust(2, '0') newfile = front + num + back puts "renaming #{file} to #{newfile}" File.rename(file, newfile) end -
randy909 created this gist
May 29, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ Dir.glob('*.mp3') do |file| front, num, back = file.match(/^(.+\()(\d+)(\).+)/).captures num = num.rjust(2, '0') newfile = front + num + back puts "renaming #{file} to #{newfile}" File.rename(file, newfile) end