Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is it possible for one of you to write a script for removing the temp files during logout for all users? (or server during restart)

Or this script can be scheduled alternate weeks.

As unnecessarily it will fill up the C drive otherwise.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

You don't want to do this or your windows updates and any other software installation needing a reboot to finish installation will fail. We tried something similar and regretted it...
I would recommend that you create a .bat file that you train your users to run after they boot up and before they open any files/programs...
You could start with:

cd %temp%    
del /F /S /Q *.*

If you want to delete other temporary locations, you would need to add them according to your environment...

share|improve this answer
1  
There's a very easy way to avoid the problem you encountered - check each files Accessed Date attribute, and only delete files that have not been accessed in X weeks/months. –  Izzy Sep 23 '09 at 15:44
1  
@Izzy: Maybe I missed something, but when trying that, I noticed that some installers did not change that attribute and it was still set a long time in the past, yet had just been added to the hard drive recently... –  Scott Lundberg Sep 23 '09 at 16:38
    
Then check on the parent folders Accessed date/time. In fact, if it was me, I'd check for the Accessed, Created, and Modified dates, and if any of them were within the last 3 months I'd leave it. –  Izzy Sep 24 '09 at 15:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.