Created
November 5, 2017 06:51
-
-
Save brentvollebregt/43c5a436816eef4a0750a3dee5cf558f to your computer and use it in GitHub Desktop.
Change/Set Modification and Last Access Time With Python
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 | |
import datetime | |
fileLocation = r"" | |
year = 2017 | |
month = 11 | |
day = 5 | |
hour = 19 | |
minute = 50 | |
second = 0 | |
date = datetime.datetime(year=year, month=month, day=day, hour=hour, minute=minute, second=second) | |
modTime = time.mktime(date.timetuple()) | |
os.utime(fileLocation, (modTime, modTime)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment