Emptying Windows temp folder is a good idea?
Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 3
--
Chapters
00:00 Question
01:29 Accepted answer (Score 18)
02:31 Answer 2 (Score 9)
03:35 Answer 3 (Score 2)
04:31 Answer 4 (Score 1)
05:12 Thank you
--
Full question
https://superuser.com/questions/418032/e...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows7 #windows
#avk47
ACCEPTED ANSWER
Score 18
As the name implies, the location is intended for files that are only supposed to be stored temporarily.
So, if you write an application and you want to store something for later retrieval, this is the wrong place for you. The Temp location is only to be used for data that, if gone, wouldn't matter anyway.
Sadly, not every programmer understands that concept.
If someone decided to place a critical file in that location, deleting that file might cause a problem to an application.
So, in my personal opinion, deleting the contents of the Temp folder shouldn't cause any problems. But due to the fact of how it is used, it can not be guaranteed to be a safe operation.
Please also keep in mind, emptying the folder while the system in operational could cause a running application to lose a file it placed there. Emptying the folder is something best done during boot.
ANSWER 2
Score 9
Emptying temp folders seems to be obvious. With most Linux distributions this is done on each boot.
But not with Windows. Why ?
Because some softwares use temp as a reliable storage accross reboot. Yes this is stupid.
Most of those softwares are doing that only after install if they need a reboot. Once done, the files can be wiped out.
Such software are now very rare. I didn't saw any since maybe 2 or 3 years.
So: use a scheduled task run on boot, which delete the content of temp folders, but only for files older than, say, 7 days.
This will do the job safely.
How to delete old files:
https://stackoverflow.com/questions/51054/batch-file-to-delete-files-older-than-n-days
ANSWER 3
Score 2
As stated by many, it should not be a problem, but honestly just in this week i was trying to 'clean' my pc by Uninstalling programs. to my dismay i couldnt uninstall a bunch because the uninstall depended on files stored in the temp folder(since the installer extracted the setup files there), which i clear regularly.
i have found programs like skype and vmware persistently holding on to files in temp folders, but i dont think they depend on them to function correctly.
once on a server, after clearing the temp folder for 'Administrator' various functions in Sql Server management studio failed because of something that couldnt be found in the temp folder.
just my experience on the bad usage of temp files.
ANSWER 4
Score 1
Deleting of temp files won't create a problem, but instead of deleting the files from the Temp directory, you can use the diskcleanup tool which was provided by Microsoft.