• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 465
  • Last Modified:

How Do I delete temp and temp internet files using a batch or vbs script and skip the ones that are in use?

I administer about 120 computers on windows 2003/2008 mixed domain environment.  All computers run windows xp and all of them have a lot of temp and temp internet files that need deleting.  I've searched the expertsexchange and have found similar problems and solutions but nothing that really details how to SKIP the files that are in use and continuing deleting.  I'm hoping to accomplish with a batch or vbs script at login and set it to run via a gpo (or is there a gpo that can accomplish this)?  Thanks!
0
netfriendsinc
Asked:
netfriendsinc
  • 3
  • 2
  • 2
  • +1
2 Solutions
 
netfriendsincAuthor Commented:
none of those options say how to continue deleting files when a file that is in use is reached.  I've used cleanup! before but it has to be run manually and I don't have time to do that on 120 computers.  The temporary internet deletion method listed in your link is helpful though :)
0
 
merowingerCommented:
files which are in use should be skipped from deletion wich all methods
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
johnb6767Commented:
Create a batch file for CCleaner.....

How to Automate the Disk Cleanup Tool in Windows XP
http://support.microsoft.com/kb/315246

Also, Set the flag in IE Advanced Options to "Empty Temporary Internet Files when browser is closed" option to help with this as well....When the browser is closed, the file handles will be released, and the files deleted.....
0
 
B HCommented:
you can just as easily issue these commands via a script:

cd /D %userprofile%
cd locals~1
rd temp /s/y
md temp
rd tempor~1 /s/y

(the md temp is to recreate the temp folder if it gets whacked, some software requires its existence
0
 
netfriendsincAuthor Commented:
johnb, thanks I'll try that today!  Bryon, I've tried that before and you cannot delete the folder while files within it are in use even with the /s switch.  Thanks all for your help so far!
0
 
B HCommented:
netfriends:  the rd foldername /s/y will do what you want...

it will purely skip over files in use, and keep going.  the only things left in those folders will be those which were in use
0
 
netfriendsincAuthor Commented:
bryon - seems that works!  Except I had to use /q instead of /y

Also, the link Merowinger posted is very helpful except for one thing.  If you change the GPO as it details in that link there is the possibilty that it will change the connection settings from 'never dial a conneciton' to 'always dial a connection'  The microsoft KB:

http://support.microsoft.com/kb/306936

thanks everyone for your input!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now