- 6546 view(s)
By running this little program, you can remove your temp files fast. I found mine were very clogged. Instead of double clicking the .py file, try scheduling it to run with MS Task Scheduler. Keep that folder clean!
I'm not attaching the code today. I'm just going to paste it here. Python wants tabs/spaces 'just so'. Make sure you match your patterns. This one is on a 'four space' indent.
Special Note: During debugging, I found something that breaks the code. There was a folder that had a name matching the *.tmp search. Because it was a folder, the program deleted the first item it correctly found then just stopped working. I don't know how to only target files at the moment, but when I do I'll add that fix here. I manually deleted that folder then this worked perfect.
Comments
Update to the code
This helps out a little bit. Now there are some 'smarts' built in. I have had it still fail in one situation, but I didn't document it and record it here. At least the code is improved. Try this one out if you are using the original or adapting it to some other code and need help.