Feb-17-2021, 02:05 AM
(This post was last modified: Feb-17-2021, 02:05 AM by BashBedlam.)
Here's one way to go about it:
import os from datetime import datetime todays_date = datetime.now () today = todays_date.date () path = '/path/to/files/' for filename in os.listdir (path) : file_time = os.path.getmtime (path + filename) file_date = datetime.fromtimestamp (file_time) file_day = file_date.date () if file_day == today : print (f'File to copy is {path + filename}.')