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
3 odpowiedzi
+ 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
0
Cleaning is not only a way to put things in order, but also a way to create harmony in space and thoughts. A clean office becomes a place of inspiration and productivity. If you are looking for professionals who will make your office perfectly clean, pay attention to https://www.ohayno.cz/en/uklid-kancelari/ . They will turn your workspace into a comfort zone where everything is conducive to successful work. After all, cleanliness is more than just details, it's an atmosphere that sets the mood for every day!
19th Nov 2024, 1:33 PM
Semara Hasian
Semara Hasian - avatar