I am trying to get files created in directory between 7AM-7PM.
ERROR_FOLDER = os.path.join(ROOT_FOLDER,"Folder","archive")
for csv in os.listdir(ERROR_FOLDER):
path = os.path.join(ERROR_FOLDER,csv)
filetime = datetime.fromtimestamp(
os.path.getctime(path))
if (date_start < filetime < date_end):
files.append(csv)
Its working ok-ish spending 13 sec to return the result from 6000 item. Is there any faster way you would suggest to me? Also how to turn it into list-comprehension?
[os.path.basename(x) for x in glob.glob(os.path.join(ROOT_FOLDER,"Excavation","Archive","*")) if (date_start < filetime < date_end)]
doesnt seem to work