fork(1) download
  1. import os
  2. from time import time
  3. from pathlib import Path
  4.  
  5. p='.'
  6. result=[os.remove(file) for file in (os.path.join(path, file) for path, _, files in os.walk(p) for file in files) if os.stat(file).st_mtime < time() - 7 * 86400]
  7. print(result)
Success #stdin #stdout 0.03s 11484KB
stdin
Standard input is empty
stdout
[]