Created
January 28, 2019 17:41
-
-
Save KonradIT/2c188ddd86402ae674429c56ee5d236f to your computer and use it in GitHub Desktop.
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 json | |
import subprocess | |
from dateutil.parser import parse | |
from datetime import datetime | |
DIR="." #current directory | |
HOUR="09" #hour to match | |
for file in os.listdir(DIR): | |
if file.endswith("JPG"): | |
p = subprocess.Popen("exiftool -FileModifyDate " + file, shell=True, stdout=subprocess.PIPE) | |
out, err = p.communicate() | |
stripped_date = str(out.decode("UTF-8")).replace("File Modification Date/Time : ","").split("+")[0] | |
new_date = datetime.strptime(stripped_date, "%Y:%m:%d %H:%M:%S").time() | |
if str(new_date).split(":")[0] == HOUR: | |
print("Date: ", stripped_date) | |
print(file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment