Created
October 5, 2014 23:22
-
-
Save milesmatthias/fecafc937b88cf9e99b1 to your computer and use it in GitHub Desktop.
A short ruby script I wrote to quicken the process of prefixing episodes with numbers on an external hard drive.
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
#!/usr/bin/env ruby | |
require 'pry' | |
require 'fileutils' | |
EPISODES = [ | |
nil, | |
nil, | |
nil, | |
"My Happy Place.mov", | |
"My ABC's.mov", | |
"My Cookie Pants.mov", | |
"My New Role.mov", | |
"My Lawyer's in Love.mov", | |
nil, | |
nil, | |
nil, | |
"Their Story II.mov", | |
"My Full Moon.mov", | |
"My Soul on Fire, Part 1.mov", | |
"My Soul on Fire, Part 2.mov", | |
nil, | |
"My Chief Concern.mov", | |
"My Finale.mov" | |
] | |
EPISODES.each_with_index do |ep, i| | |
next if ep.nil? | |
prefix = i + 1 | |
if prefix < 10 | |
prefix = "0" + prefix.to_s | |
end | |
new_name = prefix.to_s + " " + ep | |
puts "moving #{ ep } to #{ new_name }" | |
FileUtils.mv(ep, new_name) | |
end | |
exit | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment