Created
June 9, 2015 15:37
-
-
Save Junch/763b7e9be825e3d6e14a to your computer and use it in GitHub Desktop.
Rename files in a directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import os, sys | |
| import re | |
| regex='^2015.+(\d\d.+)' | |
| for file in os.listdir("."): | |
| m = re.match(regex, file) | |
| if m is not None: | |
| print m.group(1) | |
| os.rename(file, m.group(1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment