Solved

in Delphi - How can I delete the contents of the temporary folder that Internet Explorer uses?

Posted on 2011-02-23
4
461 Views
Last Modified: 2012-08-14
Thanks for reading.

I simply want to delete the contents of the temporary folder that Internet Explorer uses?

This is usually:

C:\Documents and Settings\USERNAME\Local Settings\Temporary Internet Files\

but these files are kinda "special" I think...

Anyone know how to delete this folder's content?

Thanks!
0
Comment
Question by:bobbysdog
  • 2
4 Comments
 
LVL 8

Expert Comment

by:jimsweb
ID: 34967351
The following routine deletes everything.
http://delphi.about.com/cs/adptips1999/a/bltip1199_2.htm
0
 
LVL 8

Expert Comment

by:jimsweb
ID: 34967354
This article is also dealing with temporary directories. Hope it helps.
http://stackoverflow.com/questions/503312/deleting-a-temporary-directory-in-delphi
0
 
LVL 24

Accepted Solution

by:
jimyX earned 500 total points
ID: 34967495
You can use this code from delphi.about.com:
uses
   WinInet;

procedure DeleteIECache;
var
   lpEntryInfo: PInternetCacheEntryInfo;
   hCacheDir: LongWord;
   dwEntrySize: LongWord;
begin
   dwEntrySize := 0;
   FindFirstUrlCacheEntry(nil, TInternetCacheEntryInfo(nil^), dwEntrySize) ;
   GetMem(lpEntryInfo, dwEntrySize) ;
   if dwEntrySize > 0 then lpEntryInfo^.dwStructSize := dwEntrySize;
   hCacheDir := FindFirstUrlCacheEntry(nil, lpEntryInfo^, dwEntrySize) ;
   if hCacheDir <> 0 then
   begin
     repeat
       DeleteUrlCacheEntry(lpEntryInfo^.lpszSourceUrlName) ;
       FreeMem(lpEntryInfo, dwEntrySize) ;
       dwEntrySize := 0;
       FindNextUrlCacheEntry(hCacheDir, TInternetCacheEntryInfo(nil^), dwEntrySize) ;
       GetMem(lpEntryInfo, dwEntrySize) ;
       if dwEntrySize > 0 then lpEntryInfo^.dwStructSize := dwEntrySize;
     until not FindNextUrlCacheEntry(hCacheDir, lpEntryInfo^, dwEntrySize) ;
   end;
   FreeMem(lpEntryInfo, dwEntrySize) ;
   FindCloseUrlCache(hCacheDir) ;
end;

procedure TForm1.Button1Click(Sender: TObject) ;
begin
   DeleteIECache;
end;

Open in new window

http://delphi.about.com/cs/adptips2002/a/bltip1002_2.htm
0
 

Author Closing Comment

by:bobbysdog
ID: 34967511
woo hoo thanks

p.s. i tried the other 2 solutions. they didnt work cuz the temp internet files folder is too exotic. but thank you very much for your input
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

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

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

808 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