Delete IE Temp files

We can delete the temporary files of IE. Following are the code part of delete the files.

using System.IO;

public static void Main()
ClearIETemp(new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache)));

void ClearIETemp(DirectoryInfo MyDirPath)
foreach (FileInfo MyFile in MyDirPath.GetFiles())
foreach (DirectoryInfo MySubFolder in MyDirPath.GetDirectories())

1. By using "Environment.SpecialFolder.InternetCache" we can get the
temp folder of IE files
2. The method "ClearIETemp" is used to deleted each file of the tempory files
3. recursive call of this method deleted all the subdirectory files also.



No responses found. Be the first to comment...

  • 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: