Skip to content

Instantly share code, notes, and snippets.

@waghcwb
Created April 9, 2016 22:03
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 waghcwb/80330a35d742a984ab1ca4b9b568350c to your computer and use it in GitHub Desktop.
Save waghcwb/80330a35d742a984ab1ca4b9b568350c to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os, re
regex = 'bandeira-(.*)-(.*)\.(.*)'
directory = '.'
for filename in os.listdir(directory):
name = re.search(regex, filename)
if name:
name = '{filename}.{ext}'.format(filename=name.group(1), ext=name.group(3))
os.rename(filename, name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment