日期:2014-05-18 浏览次数:20834 次
string cachePath = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);//获取缓存路径 string cookiesPath = Environment.GetFolderPath(Environment.SpecialFolder.Cookies); DirectoryInfo di = new DirectoryInfo(cachePath); DirectoryInfo di2 = new DirectoryInfo(cookiesPath); foreach (FileInfo fi in di.GetFiles("*.*", SearchOption.AllDirectories))//遍历所有的文件夹 删除里面的文件 { try { fi.Delete(); } catch (Exception ex) { } } foreach (FileInfo fi in di2.GetFiles("*.*", SearchOption.AllDirectories))//遍历所有的文件夹 删除里面的文件 { try { fi.Delete(); } catch (Exception ex) { } }