0

I want to automate the process of cleaning temporary files using python script. What should i do first?

The whole process: Open Run -> Search %temp% Select all files Delete Repeat this every two hours

27th Jul 2018, 7:31 AM
sanjeevi kumaran
sanjeevi kumaran - avatar
2 Answers
+ 2
For everything related to OS operations, use the 'os' library: https://docs.python.org/3/library/os.html For running something between intervals, use the function 'sleep' from the 'time' library: https://docs.python.org/3/library/time.html?highlight=sleep#time.sleep
27th Jul 2018, 8:19 AM
apex137
apex137 - avatar
+ 1
you can just try: iterate over the entire folder and on error pass the file. since there are always files that cant be deleted from temp. modules needed: os and time
27th Jul 2018, 9:17 AM
Markus Kaleton
Markus Kaleton - avatar