How to Delete Temporary Internet Folders from Multiple Accounts on a Single Machine

I have many PCs throughout my network that have multiple users logging into them.  Therefore I have MANY profiles under documents and settings.   I have so many that I am now seeing 40Gb hard drives getting eaten up with temporary internet files.  In particular I would like to delete the following folder:  c:\documents and settings\%username%\local settings\temporary internet folders\content.ie5.  What I would like to have is a simple script that I could run on the hard drive that would delete the folder named "content.ie5" from each profile.  I have admin rights but don't want to spend the time going through 80 or 90 profiles manually.  I will create a GPO that will set the temporary internet files to delete upon exist (from Explorer) but that won't help with those who don't log onto a particular machine again.

Thanks In Advance

Who is Participating?
greyknight17Connect With a Mentor Commented:
There is a more simpler way to do this.

Do you want to empty out ALL the temp folders?  If you do, download this freeware program to do it:

The Temp folders should be cleaned out periodically as installation programs and hijack programs leave a lot of junk there.  Download CleanUp! (Alternate Link if main link don't work - ) and install it.  Run CleanUp! and click on CleanUp! button.  When it asks you if you want to logoff, click on Yes.
I would create a batch file that would be something like this;

cd %USERPROFILE%\Local Settings\Temporary Internet Files

del *.*

If you're having a problem with temp internet files building up, two things you can do within Internet Explorer to control it are:

1) change the size of the default browser cache.  This is typically set to 5% of the drive by default, which quickly becomes unmanageable by IE.  A browser cache setting of 100MB should be more than enough for anyone of typical internet use.  (Tools, Internet Options, Temporary Internet Files, Settings button), or configure through a group policy).

2) under tools, internet options, advanced, scroll to the security section at the bottom, then check the box for "Empty Temporary Internet Files folder when browser is closed" - this should force IE, when closed by the user, to clean out the broswer cache automatically.
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

If I had this problem I would probably just use WISE to search for all folders present that are labeled "Temporary Internet Files" and just delete the contents.  You would probably have to put in a variable to continue if a specific file cannot be deleted, but it should work.  You can also do this with VB, C++, or most any other program, but because of your invironment you will probably have to tailor this to your individual needs.  The "batch" file mentioned previously is an example, but would probably only work with the currently logged on user - not all of them!
The batch file, however, if set up under ALL USERS might, in fact, delete those files each time a user logs on (regardless of who it is).  That way the first time all the unnecessary data is delete, and the following logons are kept relatively clean.
Dale MaySecurityCommented:
greyknight17 Thanks for the link:  I downloaded and installed this little program of yours and I'm sure you know by now, user like it!
Clean Temp files is what we all want and I find this little program a great help in doing this.  
money donated to you through pay-pal and points for your link.
For the rest of you thanks for your commets and suggestions.
points on the way
Save this into a bat or cmd file (paste into txt file and change the entension to bat or cmd)

c:\windows\system32\cleanmgr.exe /dc /sageset: 11
cd \
cd c:\windows\prefetch
del *.* /q

After running the first time, set your options, including removing temp internet files, after that press ok, the box closes, this saves your settings.

Next thing to do is right click the bat or cmd file and choose edit, after opening change /sageset: 11 to /sagerun: 11

and close and choose yes to save it,

Now you can run this anytime you want to do a complete system cleanup including prefetch data which can cause slowdowns when it becomes full of irrelevant data.
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.

All Courses

From novice to tech pro — start learning today.