# Check if the file is older than a month
file_creation_time = datetime.fromtimestamp(path.stat().st_ctime)
one_month_ago = datetime.now() - timedelta(weeks=5)
return file_creation_time >= one_month_ago
If the Windows file isn't deleted, creation time it will not change. Using st_ctime to determine will result in repeated downloads; it should be judged using the modification time, st_mtime.
# Check if the file is older than a month
file_mod_time = datetime.fromtimestamp(path.stat().st_mtime)
one_month_ago = datetime.now() - timedelta(weeks=5)
return file_mod_time >= one_month_ago