Skip to content

Instantly share code, notes, and snippets.

@boncey
Created March 14, 2013 09:28
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 boncey/5160037 to your computer and use it in GitHub Desktop.
Save boncey/5160037 to your computer and use it in GitHub Desktop.
Output commands to rename a series of video files according to input criteria
#!/usr/bin/env ruby
if ARGV.length < 4
print "Usage: rename-boxee <name> <series> <show> <files...>\n"
exit(-1)
end
name = ARGV.shift
series = ARGV.shift.to_i
show = ARGV.shift.to_i
files = ARGV
files.each do |filename|
ext = File.extname(filename)
show_name = "%02d" % show
new_name = "#{name} #{series}x#{show_name}#{ext}"
show = show + 1
puts "mv '#{filename}' '#{new_name}'\n"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment