Geekpedia Tutorials Home

Building a C# Chat Client and Server

Building a C# Chat Client and ServerA step by step tutorial teaching you how to create your own chat client and chat server easily in C#, for local networks or the Internet.

in C# Programming Tutorials

Getting Hard Drive Information

Getting Hard Drive InformationA C# tutorial showing you how to make use of WMI to extract information on disk drives, such as model, capacity, sectors and serial number.

in C# Programming Tutorials

UPS Shipping Calculator

UPS Shipping CalculatorThis tutorial will teach you how to calculate the shipping cost based on the weight, height, length and depth of the box, the distance and the UPS service type.

in PHP Programming Tutorials

Create Your Own Rich Text Editor

Create Your Own Rich Text EditorCreating a Rich Text Editor using JavaScript is easier to do than you might think, thanks to the support of modern browsers; this tutorial will walk you through it.

in JavaScript Programming Tutorials
Search
Tutorials
Programming Tutorials
IT Jobs
From CareerBuilder

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.

On Friday, October 17th 2008 at 09:31 PM
By Andrew Pociu (View Profile)
****-   (Rated 3.4 with 8 votes)
Contextual Ads
More C# Resources
Advertisement
  1. using System.IO;
  2.  
  3. public static void Main()
  4. {
  5.    ClearFolder(new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache))); // Execute ClearFolder() on the IE's cache folder
  6. }
  7.  
  8. void ClearFolder(DirectoryInfo diPath)
  9. {
  10.    foreach (FileInfo fiCurrFile in diPath.GetFiles())
  11.    {
  12.       fiCurrFile.Delete();
  13.    }
  14.    foreach (DirectoryInfo diSubFolder in diPath.GetDirectories())
  15.    {
  16.       ClearFolder(diSubFolder); // Call recursively for all subfolders
  17.    }
  18. }
  19.  
Digg Digg It!     Del.icio.us Del.icio.us     Reddit Reddit     StumbleUpon StumbleIt     Newsvine Newsvine     Furl Furl     BlinkList BlinkList

Rate Rate this code snippet
Comment Current Comments
by somekind on Sunday, October 19th 2008 at 05:30 PM

Why it does not work?

by irtu on Thursday, November 20th 2008 at 10:49 AM

neat

by onetime on Monday, December 8th 2008 at 12:14 AM

good one

by a on Monday, December 8th 2008 at 12:14 AM

xyx

by kundan on Saturday, March 14th 2009 at 12:25 PM

what about index.dat. it is not deleting...

by kundan on Saturday, March 14th 2009 at 12:29 PM

what about index.dat. it is not deleting...

by aaa on Saturday, August 8th 2009 at 09:13 PM

did not work for me. only returned one file.

by jj on Tuesday, August 11th 2009 at 08:49 AM

ah, the trick is the directories too. when you look at the Temporary Internet Files in windows explorer, it shows everything as if it was all there. its actually scattered through out a number of folder.s

by Vishal Rastogi on Tuesday, September 22nd 2009 at 03:56 AM

Its unable to delete index.dat...

by Alok Kumar Sharma on Thursday, September 30th 2010 at 06:18 AM

This is delete only default User not other user account like .
You have login as Administrator a/c on system .But dot not delete.

by Alok Kumar Sharma on Thursday, September 30th 2010 at 06:18 AM

This is delete only default User not other user account like .
You have login as Administrator a/c on system .But dot not delete.

by Passing on Saturday, November 6th 2010 at 04:28 PM

The above solution will not work in windows 7 because the files are locked and are in what Bill and the gang down at CIA central call 'Special Folders' so you need to kill Explore and IExplorer process and then change the FileInfo attributes to normal on the file and also the folder and then it's still hit and miss if you can delete the files and thats without the backups.

here is the code in C#

int DeletedCount = 0;
int CouldNotDelete = 0;
KillExplorer();
foreach (string DatFile in DatFiles)
{//Do not put break point or step into the code else explorer will start and the file will become locked again
DirectoryInfo DInfo=new DirectoryInfo(DatFile.Replace("index.dat",""));
FileAttributes OldDirAttrib = DInfo.Attributes;
DInfo.Attributes = FileAttributes.Normal;//Set to normal else can not delete
FileInfo FInfo = new FileInfo(DatFile);
FileAttributes OldFileAttrib = FInfo.Attributes;
SetAttr(FInfo, FileAttributes.Normal);
TryDelete(FInfo);
SetAttr(FInfo, OldFileAttrib);//Sets back to Hidden,system,directory,notcontentindexed
if (File.Exists(DatFile))
CouldNotDelete ;
else
DeletedCount ;

}
if (DatFiles.Count>0)//Lets get explorer running again
System.Diagnostics.Process.Start(DatFiles[DatFiles.Count - 1].Replace("index.dat", ""));
else
System.Diagnostics.Process.Start("explorer");
System.Windows.Forms.MessageBox.Show("Deleted " DeletedCount " Index.dat files with " CouldNotDelete " Errors");


return "Deleted " DeleteFileCount " Files ";
}

private void KillExplorer()
{
foreach (Process P in Process.GetProcesses())
{//Kill both these process because these are the ones locking the files
if (P.ProcessName.ToLower() == "explorer")
P.Kill();
if (P.ProcessName.ToLower() == "iexplore")
P.Kill();
}
}

private bool TryDelete(FileInfo Info)
{
try
{
Info.Delete();
return true;
}
catch
{return false;}
}

private void SetAttr(FileInfo Info,FileAttributes Attr)
{
try
{
Info.Attributes = Attr;
}
catch { }
}

by raj dube on Tuesday, November 23rd 2010 at 09:12 AM

this is the good article.
please check this useful link related to this article

http://www.mindstick.com/Articles/0bc3d03e-ec1c-489e-916e-4ba26990a2ad/

by ugg boots on Monday, August 1st 2011 at 02:31 AM


[url=http://www.uggnetstore.com ]Australia Sheepskin Ugg Boots on sale,you can buy cheap ugg boots,ugg boots 5815,discount ugg boots 5825,ugg boots 5823,ugg boots for womens,Australia Sheepskin Ugg Boots,ugg winter boots,UGG Bailey Button,UGG Classic Short,UGG Classic Tall,Ugg Classic Cardy.[/url]
[url=http://www.uggnetstore.com/ ]ugg boots[/url]
[url=http://www.uggnetstore.com/ ]cheap uggs[/url]
[url=http://www.uggnetstore.com/ ]UGG Bailey Button[/url]
[url=http://www.uggnetstore.com/ ]UGG Classic Short[/url]
[url=http://www.uggnetstore.com/ ]UGG Classic Short[/url]
[url=http://www.uggnetstore.com/ ]Ugg Classic Cardy[/url]
[url=http://www.uggnetstore.com/ ]ugg winter boots[/url]
[url=http://www.uggnetstore.com/ ]Australia Sheepskin Ugg Boots on sale[/url]
[url=http://www.uggentityshop.com ]Australia Sheepskin Ugg Boots on sale,you can buy cheap ugg boots,ugg boots 5815,discount ugg boots 5825,ugg boots 5823,ugg boots for womens,Australia Sheepskin Ugg Boots,ugg winter boots,UGG Bailey Button,UGG Classic Short,UGG Classic Tall,Ugg Classic Cardy.[/url]
[url=http://www.uggentityshop.com/ ]UGG Bailey Button[/url]
[url=http://www.uggentityshop.com/ ]UGG Classic Short[/url]
[url=http://www.uggentityshop.com/ ]ugg boots[/url]
[url=http://www.uggentityshop.com/ ]cheap uggs[/url]
[url=http://www.uggentityshop.com/ ]Ugg Classic Cardy[/url]
[url=http://www.uggentityshop.com/ ]ugg winter boots[/url]
[url=http://www.uggentityshop.com/ ]Australia Sheepskin Ugg Boots on sale[/url]
[url=http://www.netbuyugg.com ]Australia Sheepskin Ugg Boots on sale,you can buy cheap ugg boots,ugg boots 5815,discount ugg boots 5825,ugg boots 5823,ugg boots for womens,Australia Sheepskin Ugg Boots,ugg winter boots,UGG Bailey Button,UGG Classic Short,UGG Classic Tall,Ugg Classic Cardy.[/url]
[url=http://www.netbuyugg.com/ ]ugg winter boots[/url]
[url=http://www.netbuyugg.com/ ]Australia Sheepskin Ugg Boots on sale[/url]
[url=http://www.netbuyugg.com/ ]ugg boots[/url]
[url=http://www.netbuyugg.com/ ]cheap uggs[/url]
[url=http://www.netbuyugg.com/ ]UGG Bailey Button[/url]
[url=http://www.netbuyugg.com/ ]UGG Classic Short[/url]
[url=http://www.netbuyugg.com/ ]UGG Classic Short[/url]
[url=http://www.netbuyugg.com/ ]Ugg Classic Cardy[/url]
[url=http://www.ibuyugg.com ]Welcome to the cheap uggs|a nature shop website offering a comprehensive range of sheepskin cheap uggs and ugg boots. Aside from our highly competitive pricing,we offer free fast shipping world wide included in all of our prices and a 100% products original package of ugg boots.[/url]
[url=http://www.ibuyugg.com/ugg-classic-short-boots.html ]ugg classic short[/url]
[url=http://www.ibuyugg.com/ ]wholesale ugg boots[/url]
[url=http://www.ibuyugg.com/ ]ugg boots[/url]
[url=http://www.ibuyugg.com/ ]cheap uggs[/url]
[url=http://www.ibuyugg.com/ ]ugg boots sale[/url]
[url=http://www.uggbootsgood.com ]Authentic cheap UGGs store,buy latest styles and cheap UGG Boots.welcome to our professional UGGs for cheap store|offering UGG Boots sale and UGGs outlet on all styles|save up to 70%|free shipping and fast delivery.[/url]
[url=http://www.uggbootsgood.com/ ]ugg boots online[/url]
[url=http://www.uggbootsgood.com/ ]ugg boots sale[/url]
[url=http://www.uggbootsgood.com/ ]ugg boots outlet[/url]
[url=http://www.uggbootsgood.com/ ]uggs for cheap[/url]
[url=http://www.uggbootsgood.com/ ]uggs on sale[/url]
[url=http://www.uggbootsgood.com/ ]ugg australia[/url]
[url=http://www.uggbootsgood.com/ ]ugg boots[/url]
[url=http://www.esaleugg.com ]Welcome to the cheap uggs,a nature shop website offering a comprehensive range of sheepskin cheap uggs and ugg boots. Aside from our highly competitive pricing|we offer free fast shipping world wide included in all of our prices and a 100% products original package of ugg boots.[/url]
[url=http://www.esaleugg.com/ ]uggs outlet[/url]
[url=http://www.esaleugg.com/ ]wholesale ugg boots[/url]
[url=http://www.esaleugg.com/ ]ugg boots[/url]
[url=http://www.esaleugg.com/ ]cheap uggs[/url]
[url=http://www.esaleugg.com/ ]uggs for cheap[/url]
[url=http://www.esaleugg.com/ ]ugg boots sale[/url]
[url=http://www.prettyuggboots.com ]prettyuggboots.com ugg boots website sales AAA replica ugg boots ,50%-70% Off Freeshipping cheap ugg boot,fake ugg boots ,UGG sheepskin shoes,UGG celtic sheepskin,Best after-sale service and fast delivery![/url]
[url=http://www.prettyuggboots.com/ ]ugg boots website[/url]
[url=http://www.prettyuggboots.com/ ]replica ugg boots[/url]
[url=http://www.prettyuggboots.com/ ]ugg boots[/url]
[url=http://www.prettyuggboots.com/ ]cheap uggs[/url]
[url=http://www.prettyuggboots.com/ ]cheap ugg boot[/url]
[url=http://www.prettyuggboots.com/ ]fake ugg boots[/url]
[url=http://www.prettyuggboots.com/ ]wholesale ugg boots[/url]

by dosing tank on Monday, August 22nd 2011 at 09:25 AM

This doesn't seem to work for me...

by Contextual Links on Monday, December 12th 2011 at 12:36 PM

Hey do you know why my phone shuts off almost every other time I close the phone shut?! It's driving me crazy and its not because I have low battery.

by Caribou Hunts Alaska on Saturday, December 17th 2011 at 04:57 PM

Hey do you know why my phone shuts off almost every other time I close the phone shut?! It's driving me crazy and its not because I have low battery.

by GenF20 Plus on Monday, December 19th 2011 at 04:46 PM

This communicating provided by you is rale micturate for prudish cerebration. and I dont believe omens its just the narrow thinking.

by GenFX on Monday, December 19th 2011 at 04:50 PM

I am quite excited with all the article content of your site.

by Nuratrim on Monday, December 19th 2011 at 04:55 PM

The information and the detail were just perfect. I think that your perspective is deep, its just well thought out and really fantastic to see someone who knows how to put these thoughts down

by Phen375 on Monday, December 19th 2011 at 04:58 PM

The information and the detail were just perfect. I think that your perspective is deep, its just well thought out and really fantastic to see someone who knows how to put these thoughts down

by Human Growth Hormone on Monday, December 19th 2011 at 05:00 PM

I think you could try this:
((NumToValidate!=null))

by Dental White on Monday, December 19th 2011 at 05:02 PM

I think you could try this:
((NumToValidate!=null))

by Teeth Whitening Reviews on Monday, December 19th 2011 at 05:04 PM

This is cool. I just wanted to let you know how much I enjoy reading the blog, and hope you keep posting such great material.

by Best Diet Pills on Monday, December 19th 2011 at 05:05 PM

This is cool. I just wanted to let you know how much I enjoy reading the blog, and hope you keep posting such great material.

by HGH Advanced on Monday, December 19th 2011 at 05:10 PM

The information and the detail were just perfect.

by Proactol Plus on Monday, December 19th 2011 at 05:11 PM

The information and the detail were just perfect.

by Botanical White on Monday, December 19th 2011 at 05:12 PM

The information and the detail were just perfect.

by Pure Acai Berry Max on Monday, December 19th 2011 at 05:13 PM

Do you know how the random.next selects the random number? Meaning Does every possibility(number) have an equal chance/probability of occurring? I am trying to have something specific done 65% of the time it is prompted

by Ultimate Maqui Berry on Monday, December 19th 2011 at 05:14 PM

Do you know how the random.next selects the random number? Meaning Does every possibility(number) have an equal chance/probability of occurring? I am trying to have something specific done 65% of the time it is prompted

by Meratol on Monday, December 19th 2011 at 05:16 PM

My solutution is for those cases you need a good "start" seed for a long series of random numbers, because the numbers in the random class is random itself. The most important thing is NOT to shuffle in the random number array BUT to get different startpoints in the random array.

by cases ipad 2 on Tuesday, January 10th 2012 at 01:09 AM

This codes is something that I have been looking for... Thanks for this.

by funeral flower arrangements on Saturday, January 21st 2012 at 05:21 PM

Interesting topic what you have shared with us. Your writing skill is really very appreciative. I love when you share your views through the best articles.Keep sharing and posting articles like these.This article has helped me a lot.Keep posting this stuff.

by rn to bsn online programs on Monday, January 23rd 2012 at 07:28 PM

Always inadvertently see things like this, I am very interested, unable to hold oneself back to share with the people around me have a look. I support your ideas, and I wish you make persistent efforts.

by on Thursday, February 2nd 2012 at 07:15 AM

This is a fantastic website and I can not recommend you guys enough. Full of useful resource and great layout very easy on the eyes. Please do keep up this great work.

by James Walker on Saturday, February 18th 2012 at 11:38 AM

Do you know how the random.next selects the random number? Meaning Does every possibility(number) have an equal chance/probability of occurring? I am trying to have something specific done 65% of the time it is prompted

by craftmatic mattresses on Sunday, February 19th 2012 at 03:01 PM

You really make it seem so easy with your presentation but I find this topic to be really something which I think I would never understand.

by young drivers cheap jokes car insurance on Wednesday, February 22nd 2012 at 12:31 AM

Truly impressive and nice information,it's good material to study this post increases my knowledge.

Appreciate it...

by on Wednesday, February 22nd 2012 at 12:44 AM

Truly impressive and nice information,it's great material to read through this post increases my knowledge.

Thanks...

by young drivers cheap jokes car insurance on Wednesday, February 22nd 2012 at 12:45 AM

Truly impressive and nice information,it's good material to study this post increases my knowledge.

Appreciate it...

by little insurance l on Sunday, February 26th 2012 at 09:20 PM

I cant stop looking over this. Its so cool, so rich in information i always just didnt know. Im glad to discover that individuals are covering this issue in this particular smart way, showing us all different sides to it. Youre an incredible blogger. Please continue the good work. I cant wait to read whats next.


by sleep number bed prices on Thursday, March 22nd 2012 at 07:32 PM

I came across this and interesting stuff is present here.I will bookmark your website and share with my friends. I am waiting for your next interesting post.

by Enter Technology on Sunday, March 25th 2012 at 04:59 AM

because the numbers in the random class is random itself. The most important thing is NOT to shuffle in the random number array. Enter Technology

by cheap online masters degree programs on Monday, March 26th 2012 at 09:28 PM

i got alot of inforamtion here

by Milgard Vinyl Windows on Wednesday, March 28th 2012 at 12:48 PM

This also didn't work as well as I was hoping, it didn't execute the way it did for you, but I think I just found a fix I'll post my issue and the solution in case anyone else is running into the same issue as me. Besides that very good walk-through for IE!

Milgard vinyl windows

by Natox on Thursday, March 29th 2012 at 07:28 PM

Interesting topic what you have shared with us. Your writing skill is really very appreciative. I love when you share your views through the best articles.Keep sharing and posting articles like these.This article has helped me a lot.Keep posting this stuff.

by ClearPores on Thursday, March 29th 2012 at 07:36 PM

Interesting topic what you have shared with us. Your writing skill is really very appreciative. I love when you share your views through the best articles.Keep sharing and posting articles like these.This article has helped me a lot.Keep posting this stuff.

by Acne Treatments That Work on Thursday, March 29th 2012 at 08:01 PM

Interesting topic what you have shared with us. Your writing skill is really very appreciative. I love when you share your views through the best articles.Keep sharing and posting articles like these.This article has helped me a lot.Keep posting this stuff.

by Adult Acne Treatment on Thursday, March 29th 2012 at 08:32 PM

Interesting topic what you have shared with us. Your writing skill is really very appreciative. I love when you share your views through the best articles.Keep sharing and posting articles like these.This article has helped me a lot.Keep posting this stuff.

by Capsiplex on Thursday, March 29th 2012 at 08:36 PM

Interesting topic what you have shared with us. Your writing skill is really very appreciative. I love when you share your views through the best articles.Keep sharing and posting articles like these.This article has helped me a lot.Keep posting this stuff.

by Nuratrim on Thursday, March 29th 2012 at 08:40 PM

Interesting topic what you have shared with us. Your writing skill is really very appreciative. I love when you share your views through the best articles.Keep sharing and posting articles like these.This article has helped me a lot.Keep posting this stuff.

by Raspberry Ketone on Thursday, March 29th 2012 at 08:44 PM

Interesting topic what you have shared with us. Your writing skill is really very appreciative. I love when you share your views through the best articles.Keep sharing and posting articles like these.This article has helped me a lot.Keep posting this stuff.

by Acne Treatment Reviews on Thursday, March 29th 2012 at 08:49 PM

Interesting topic what you have shared with us. Your writing skill is really very appreciative. I love when you share your views through the best articles.Keep sharing and posting articles like these.This article has helped me a lot.Keep posting this stuff.

by best payday loan on Monday, April 2nd 2012 at 03:12 PM

I love when you share your views through the best articles.Keep sharing and posting articles like these.This article has helped me a lot.Keep posting this stuff.

by Youth Bats on Tuesday, April 3rd 2012 at 01:58 AM

I am very thank you to share this article, it is very good, thanks mate!

by latex mattress on Sunday, April 8th 2012 at 12:23 PM

It really is almost the 1st time My partner and i knowledge the like. In fact I'm considering making my own a single.The major search engines results pages are quite obvious, so in retrospect they will function. Simple.Thus appreciate your that.Very interesting blog. Alot of blogs I see these days don't really provide anything that I'm interested in, but I'm most definately interested in this one. Just thought that I would post and let you know.

by Find Cell Phone Numbers O on Wednesday, April 11th 2012 at 05:19 AM

those cases you need a good "start" seed for a long series of random numbers, because the numbers in the random class is random itself.

by beste tagesgeld zinsen on Thursday, April 12th 2012 at 01:52 AM

It is well that from time to time temporary files are erased. This can improved PC performance.

by craftmatic beds on Tuesday, April 17th 2012 at 12:31 AM

Excellent read, I just passed this onto a friend who was doing some research on that. And he actually bought me lunch as I found it for him smile Therefore let me rephrase that: Thank you for lunch.I dare to continue his good deed, get a good night!

by rn-bsn on Friday, April 20th 2012 at 01:41 AM

I am sure many of you will be having similar problem.

by Vogel TV Brackets on Wednesday, April 25th 2012 at 06:23 AM

I enjoy reading the blog, and hope you keep posting such great material.

by graphic t-shirts on Thursday, April 26th 2012 at 07:26 AM

when you look at the Temporary Internet Files in windows explorer, it shows everything as if it was all there.

by Chintan on Monday, April 30th 2012 at 10:23 AM

not working rply pls...

Error:"Error 1 An object reference is required for the non-static field, method, or property 'ConsoleApplication1.Program.ClearFolder(System.IO.DirectoryInfo)' C:\Users\Chintan\Documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs 14 13 ConsoleApplication1
"

by bathroom vanities on Tuesday, May 1st 2012 at 01:00 PM

Where else could anyone get that kind of information in such a perfect way of writing?

by Baby Games on Sunday, May 6th 2012 at 01:21 AM

It is well that from time to time temporary files are erased. This can improved PC performance.

by Fish Games on Sunday, May 6th 2012 at 01:24 AM

This also didn't work as well as I was hoping

by aarp car insurance re on Sunday, May 6th 2012 at 04:11 AM

Really very useful tips are provided here. Thank you so much. Keep up the good works.

by youporn on Thursday, May 10th 2012 at 04:56 PM

This is a great article, when I try and explain the importance of Keyword research to clients I sometimes really struggle.

by masters of arts in education on Friday, May 11th 2012 at 03:48 AM

those cases you need a good "start" seed for a long series of random numbers, because the numbers in the random class is random itself.

by china wholesale on Tuesday, May 15th 2012 at 10:15 PM

nice post,thanks for sharing! BTW,check out my new android 4.0 tablet china wholesale.

by find out more on Wednesday, May 16th 2012 at 08:01 AM

Thanks for sharing this, you run a wonderful blog filled with good posts.I hope you will keep us update about environmental conversation. Thank you so much in Advance.

by Naples Real Estate on Thursday, May 24th 2012 at 05:29 PM

I am very much pleased with the contents you have mentioned. I wanted to thank you for this great article.

by personal statements for col on Sunday, May 27th 2012 at 06:37 AM

I really appreciate the believed that you put into this content. This subject has been something I have been looking into for a few time and your publish is one of the best I have study.


Comment Comment on this tutorial
Name: Email:
Message:
Comment Related Source Code
There is no related code.

Comment Related Tutorials
There are no related tutorials.

Jobs C# Job Search
My skills include:

Enter a City:

Select a State:


Advanced Search >>
Sponsors

From the creators of Geekpedia, a revolutionary new coupon website!

BargainEZ has coupons codes, printable coupons, bargains and it is the leading source of Passbook coupons for iPhone and iPod touch devices.

Coupons
Discover Geekpedia
Other Resources