Created
July 19, 2015 00:19
-
-
Save christopher-baek/d0d37800d4141c50606a to your computer and use it in GitHub Desktop.
generate a new filename based on a file's "last modified" time (in YYYYMMDDHHMMSS format)
This file contains 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 time | |
def new_filename_from_mtime(filename): | |
new_filename = time.strftime('%Y%m%d%H%M%S', | |
time.strptime( | |
time.ctime(os.path.getmtime(filename)))) | |
return new_filename |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment