代码如下: using System.IO; ... void clearIECache() { ClearFolder (new DirectoryInfo (Environment.GetFolderPath (Environment.SpecialFolder.InternetCache))); } void ClearFolder (DirectoryInfo folder) { foreach (FileInfo file in folder.GetFiles()) { file.Delete(); } foreach (DirectoryInfo subfolder in folder.GetDirectories()) { ClearFolder(subfolder); } } public static void Main( ) { new Test().clearIECache (); }
|