Nov-09-2021, 03:04 AM
I made changes to the code, I think I'm very close but failing to compare 2(two) time stamps.
yesterday var is formated as YYYY-MM-DD
and the ts var as YYYY-MM-DD HH:MM:SS.milliseconds
yesterday var is formated as YYYY-MM-DD
and the ts var as YYYY-MM-DD HH:MM:SS.milliseconds
for dr_name in os.listdir(tz): dr_path = os.path.join(tz, dr_name) if os.path.isdir(dr_path): print("Directory path name:", dr_path) yesterday = dt.datetime.now().date() - dt.timedelta(days=1) ts = datetime.datetime.fromtimestamp(os.path.getmtime(dr_path)) print(f" File T_stamp > {ts}") if datetime.datetime.fromtimestamp(os.path.getmtime(dr_path)) == yesterday: print(f" Yesterday file -> {dr_path}")