Created
August 26, 2014 00:31
-
-
Save iAladdin/f8c56d1fa817c28b6fe6 to your computer and use it in GitHub Desktop.
rename wwdc-subtitles
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 characters
movs = Dir['./*'] | |
hash = Hash.new | |
movs.each do |f| | |
key = f[2,3] | |
value = f[2,f.length-6] | |
hash[key] = value | |
end | |
srts = Dir["/Users/Aladdin/Workspace/WWDC_2014_Video_Subtitle/*.srt"] | |
srts.each do |srt| | |
arg1 = "#{srt}".shellescape | |
arg2 = "#{srt[0,50]}#{hash[srt[50,3]]}.srt".shellescape | |
FileUtils.mv(arg1,arg2) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it should run in irb