import os, pathlib, exifread, time, datetime
from win32_setctime import setctime
for path in os.listdir('.'):
if os.path.isfile(path) and pathlib.Path(path).suffix!='.py':
with open(path, 'rb') as image:
exif = exifread.process_file(image)
try:
crtdate = time.mktime(datetime.datetime.strptime(str(exif['EXIF DateTimeOriginal']), "%Y:%m:%d %H:%M:%S").timetuple())
os.utime(path, (crtdate, crtdate))
setctime(path, crtdate)
except:
print('hello')
Комментариев нет:
Отправить комментарий