I want to delete all the files older than one day except the hidden files
I have tried the below code but it seems it also tries to delete hidden files, how can I modify it so that it deletes all the files but not hidden files?
import os
import time
current_time = time.time()
for f in os.listdir():
creation_time = os.path.getctime(f)
if (current_time - creation_time) // (24 * 3600) >= 1:
os.unlink(f)
print('{} removed'.format(f))
If it was linux, I could have done,
if not f.startswith('.'):
I have gone through the links: https://bitbucket.org/aafshar/pida-main/src/tip/pida/services/filemanager/filemanager.py
I do not probably understand it. A more simple code would be appreciated.