Last active
April 17, 2018 10:04
-
-
Save songpon/9c7f5ab7237f988cf3eeec4fa0ffd3ca to your computer and use it in GitHub Desktop.
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
| import os | |
| import datetime | |
| import glob | |
| def modification_date(filename): | |
| t = os.path.getmtime(filename) | |
| return datetime.datetime.fromtimestamp(t) | |
| files = glob.glob('*') | |
| for l in files: | |
| if l.endswith('py'): | |
| continue | |
| dt = modification_date(l) | |
| out = dt.strftime("%Y%m%d") | |
| newname = '%s-%s' % ( out,l,) | |
| print newname | |
| os.rename(l, newname) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment