Code snippet for deleting all the Temporary Internet files,


code snippet for deleting all the Temporary Internet files.

This code will going to help for clearing the cache content.

Sample Code:


Main Function:

public static void Main( )
{
new Test().clearIECache ();
}

Function definition:

Sample Code:

void clearIECache()
{
ClearFolder (new DirectoryInfo (Environment.GetFolderPath
(Environment.SpecialFolder.InternetCache)));
}

Function definition for ClearFolder:

Sample Code:
void ClearFolder (DirectoryInfo folder)
{
foreach (FileInfo file in folder.GetFiles())
{ file.Delete(); }
foreach (DirectoryInfo subfolder in folder.GetDirectories())
{ ClearFolder(subfolder); }
}


!!!!!!! Please Include the Below Header file!!!!!!!!!!!!!

using System.IO;

Regards
Anup


Comments

Author: asdfg04 Mar 2010 Member Level: Gold   Points : 0

nice article...



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: