Solved

VB - Deleting Temporary Internet Files

Posted on 2001-08-09
9
231 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
  • 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

Technology Partners: 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!

Question has a verified solution.

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

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

685 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