Advertisement
MaxObznyi

Q.24

Nov 17th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. import os
  2. import time
  3.  
  4. current_time = time.time()
  5.  
  6. for f in os.listdir():
  7. file_creation_time = os.path.getctime(f)
  8. if (current_time - file_creation_time) // (24 * 3600) >= 3:
  9. os.unlink(f)
  10. print('{} removed'.format(f))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement