Skip to content

Instantly share code, notes, and snippets.

@tommorris
Created August 25, 2015 09:12
Show Gist options
  • Save tommorris/a617b158c014c868a71a to your computer and use it in GitHub Desktop.
Save tommorris/a617b158c014c868a71a to your computer and use it in GitHub Desktop.
def change_filename fn
matcher = /Statement--(\d{6})-\d+--(\d{2})-(\d{2})-(\d{4})-(\d{2})-(\d{2})-(\d{4}).pdf/
return fn.gsub(matcher, '\4-\3-\2 - \7-\6-\5.pdf')
end
`ls | grep Statement`.split("\n").each do |fn|
`mv "#{fn}" "#{change_filename(fn)}"`
end
# MIT licensed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment