---
title: "Delete All Temporary Internet Files of IE"  
description: "Here I’m going to demonstrate how to delete all Temporary Internet Files of Internet Explorer through C#.Net.Example private void btnDelete_Click(obje"  
author: "Anonymous User"  
published: 2010-11-20  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/55/delete-all-temporary-internet-files-of-ie  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Delete All Temporary Internet Files of IE

Here I’m going to demonstrate how to [delete](https://www.mindstick.com/forum/33620/how-to-delete-record-from-list-in-mvc-using-ajax) all [Temporary](https://www.mindstick.com/forum/2292/how-to-set-temporary-path-of-jdk-in-windows) [Internet](https://www.mindstick.com/articles/44650/what-should-you-do-during-an-internet-outage) [Files](https://www.mindstick.com/articles/23302/the-importance-and-advantage-of-keeping-your-important-files-on-the-cloud) of Internet [Explorer through C#](https://www.mindstick.com/forum/110/how-to-delete-temperory-internet-files-of-internet-explorer-through-c-sharp).Net.

##### Example

```
private void btnDelete_Click(object sender, EventArgs e)         { //creating directory info and asigning it the path of internet cache. DirectoryInfo di = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache)); //assigning no. of directories in the folder to x             int x = di.GetDirectories().Count();            //calling clear() method             clear(di);             MessageBox.Show("Deleted");         }  //clear() Method         public void clear(DirectoryInfo di)         {   //loop for each file in directory                        foreach (FileInfo fi in di.GetFiles())             {                 try                 { //deleting the file                     fi.Delete();                 }                 catch (Exception ex)                 {                     //MessageBox.Show(ex.Message);                 }             } //claaing clear() method recursively for each directory in current directory.             foreach (DirectoryInfo sub in di.GetDirectories())                 clear(sub);         }
```

---

Original Source: https://www.mindstick.com/blog/55/delete-all-temporary-internet-files-of-ie

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
