Skip to content

Instantly share code, notes, and snippets.

@milesmatthias
Created October 5, 2014 23:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milesmatthias/fecafc937b88cf9e99b1 to your computer and use it in GitHub Desktop.
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.
#!/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