Nov-09-2021, 03:21 AM
In line 5 you start with a datetime (from now()), but then convert it into a date (with .date()).
In line 8 you're comparing a timestamp to a date which won't match. What you might want is to compare the date of that timestamp with your yesterday date.
In line 8 you're comparing a timestamp to a date which won't match. What you might want is to compare the date of that timestamp with your yesterday date.
if datetime.datetime.fromtimestamp(os.path.getmtime(dr_path)).date() == yesterday:Another preference might be to see if the timestamp lies between two datetime() timestamps.