Created
January 10, 2012 05:14
-
-
Save andy318/1587134 to your computer and use it in GitHub Desktop.
Ruby shell code - Find song files that have a single digit track number and prefix 0 to it
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
#!/usr/bin/env ruby | |
# Tested in REE 1.8.7. To run from command line, type - | |
# ruby AddLeadingZeroToSongFile.rb | |
`ls -1 *.mp3`.split("\n").each do | songfile | | |
x = /^(\d .*)/.match(songfile) | |
`mv "#{x.captures[0]}" "0#{x.captures[0]}"` if x | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment