Skip to content

Instantly share code, notes, and snippets.

@hirokai
Created November 4, 2015 03:38
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 hirokai/d27bcc8daa9082a2636e to your computer and use it in GitHub Desktop.
Save hirokai/d27bcc8daa9082a2636e to your computer and use it in GitHub Desktop.
Shift time stamps of all the files in a folder
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