Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting files from internet cache 2

Status
Not open for further replies.

Mindbender311

Instructor
Mar 5, 2005
7
US
Hello,

I am having trouble figuring out a weird issue. I am trying to get all files in the special folder InternetCache. The problem is only two items show up when I get all files and folders in the directory. The two items I get are desktop.ini and Content.IE5. I check the directory on the drive and more files exists than those two.

My question is what am I doing wrong?

Here is the line to get the files from the directory.
Code:
string [] files = Directory.GetFileSystemEntries(Environment.GetFolderPath(
                 Environment.SpecialFolder.InternetCache));

After that line I display all the files/folders retreived.

Thanks for any information.
 
Windows explorer shows you all files under "Temporary internet files" in one directory, but actually they are spread in many directories. Open a command window and you'll see it yourself.
You have to make a recursive search in all sub directories.
 
Mindbender311, how did you do it?

__________________________________________
Try forum1391 for lively discussions
 
It is somewhat crude, but works. Here is what I did.

Code:
private void cleanFolder (string path)
		{
			try
			{
				// delete directory
				Directory.Delete (path, true);
               // recreate the directory if it actually gets deleted all the way.
				if ( !Directory.Exists(path) )
					Directory.CreateDirectory(path);
				
			}
			catch (Exception )
			{				
			}
		}

I pass to the method Environment.GetFolderPath (Environment.SpecialFolder.InternetCache ).

It wipes out all files except for an index.dat that is being used.
 
I guess I should have stated that my goal was to delete the cache. Sorry.
 
Thanks Mind, and Korach.

__________________________________________
Try forum1391 for lively discussions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top