Solved

VB - Deleting Temporary Internet Files

Posted on 2001-08-09
9
232 Views
Last Modified: 2010-05-02
Anyone know how to implement VB code to delete the files in "C:\Windows\Temporary Internet Files"?

I have tried using "Dir" function and "FileSystemObject" object, however they do not recognize the entries in that directory as actual files.

Any help would be appreciated.
0
Comment
Question by:Marker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +3
9 Comments
 
LVL 3

Expert Comment

by:andysalih
ID: 6370378
shell ("attrib -r c:\where\ever\*.*")
shell ("del c:\where\ever\*.*")

thats it

cheers
Andy


0
 
LVL 20

Expert Comment

by:hes
ID: 6370382
Here is the only example that I have found that works using vb code:

http://www.domaindlx.com/e_morcillo/scripts/cod/default.asp?page=ie#ietemp
0
 

Author Comment

by:Marker
ID: 6370465
To: andysalih,

This solution does not work, since the entries in "C:\Windows\Temporary Internet Files" directory do not appear as normal, hidden or system files to the DOS shell.

Thanks for the effort though :)

 
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6370877
Try...

Kill "C:\Windows\Temporary Internet Files\*.*"
0
 
LVL 8

Expert Comment

by:glass_cookie
ID: 6370903
Hi Dave_Greene!

Here's just my opinion.  The last time I manually deleted all the files in the "C:\Windows\Temporary Internet Files", my IE5 gave me some "cannot open the search page" or something like that.

So, using

Kill "C:\Windows\Temporary Internet Files\*.*"

may cause your IE to be down since it's more or less the smae thing.  Deleting of cookies killed my IE.  Mail would still work though.

---

On the other hand, you may want to kill those files using Dave_Greene's method, but do a check on whether it's a cookie ot not.  Remember, delete those files only IF they are NOT cookies.  The one and only thing that caused the 'death' of my IE was the deleting of cookies.  Delete any thing you want in that folder, just don't touch the cookies.

That's it!

glass cookie : )
0
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 50 total points
ID: 6371082
0
 

Author Comment

by:Marker
ID: 6373534
To Richie Simonetti,

Thanks, this example is nice and clean and works well, I would recommend it to others.


To Glass Cookie,

Thanks for the feedback, the example from Ritchie checks if the entry is a cookie and avoids the mishaps you may have encountered by deleting any cookies in this directory.

To Hes,

This code does work, but seems a little complicated (I am a total Newbie at VB so it's easy to confuse me...:) the example from Ritchie is a cleaner method.

Thanks to all who replied....

0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6373607
You are welcome. Glad to help.
0
 
LVL 20

Expert Comment

by:hes
ID: 6374156
No problem, just glad you got a solution you like and can use :)
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question