generate functionSun, 13 Nov 2022

Check D:\ for files named *.tdarrcache. If they are over 2 days old from the time they were created, delete them.

import os import time def file_age_in_seconds(pathname): return time.time() - os.stat(pathname).st_ctime for pathname in os.listdir('D:'): if pathname.endswith(".tdarrcache"): full_pathname = os.path.join('D:', pathname) file_age = file_age_in_seconds(full_pathname) if file_age > 172800: os.remove(full_pathname)

Questions about programming?Chat with your personal AI assistant