Skip to content

Instantly share code, notes, and snippets.

@jamesshipton
Created January 4, 2012 06:46
Show Gist options
  • Save jamesshipton/1558848 to your computer and use it in GitHub Desktop.
Save jamesshipton/1558848 to your computer and use it in GitHub Desktop.
Rename files in the current dir, if they match the regex
Dir.entries(".").each { |filename| if (filename =~ /\A[0-9]{3}-[a-zA-Z0-9]+-(.+)-small(.mp4)\Z/) then File.rename(filename, $1+$2) end }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment