Delete All Temporary Internet Files Of IE

Delete All Temporary Internet Files Of IE
Delete all the temporary files from Internet Explorer's cache folder using basic methods available in the System.IO namespace.
using System.IO;
 
public static void Main()
{
   ClearFolder(new 


DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache))); // Execute ClearFolder() on the IE's cache folder
}
 
void ClearFolder(DirectoryInfo diPath)
{
   foreach (FileInfo fiCurrFile in diPath.GetFiles())
   {
      fiCurrFile.Delete();
   }
   foreach (DirectoryInfo diSubFolder in diPath.GetDirectories())
   {
      ClearFolder(diSubFolder); // Call recursively for all subfolders
   }
}
 

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top