Skip to content

Instantly share code, notes, and snippets.

@oki
Created December 4, 2008 22:38
Show Gist options
  • Select an option

  • Save oki/32124 to your computer and use it in GitHub Desktop.

Select an option

Save oki/32124 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# sir, avi
ARGV[0] || (puts "Use ./#{$0} dir"; exit 0)
n = 0
Dir[ARGV[0]+'/*'].sort_by { |f|
File.stat(f).mtime
}.each { |f| `mv #{f} #{f.gsub(/([^\/])+$/, ('%03d.avi' % n=n+1))}` }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment