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!
netfriendsincAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.