Created
November 4, 2015 03:38
-
-
Save hirokai/d27bcc8daa9082a2636e to your computer and use it in GitHub Desktop.
Shift time stamps of all the files in a folder
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.path, time | |
from datetime import timedelta | |
import glob | |
delta = 7*60+41 | |
folder = '/path/to/folder' | |
for file in glob.glob(os.path.join(folder,'*.JPG')): | |
print(file) | |
print "last modified: %s" % time.ctime(os.path.getmtime(file)) | |
new_time = os.path.getmtime(file)+delta | |
os.utime(file, (time.time(),new_time)) | |
print "last modified: %s" % time.ctime(os.path.getmtime(file)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment