How to get and change file name to time timestamps from image(png or jpg) in same directory with python?
And I want to make a list of that files without file extension in text file.
How to get and change file name to time timestamps from image(png or jpg) in same directory with python?
And I want to make a list of that files without file extension in text file.
This will give you the timestamp of image
from PIL import Image
def get_date_taken(path):
return Image.open(path).getexif()[36867]
This will change the filename
import os
os.rename(r'file path\OLD file name.file type',r'file path\NEW file name.file type')
And finally you can find all images with this code
from os import walk
f = []
for (dirpath, dirnames, filenames) in walk(mypath):
f.extend(filenames)
break
Try to combine all of these codes.