Mon*_*RPG 5 c# windows .net-4.0 temporary-files
我想完全清除临时Internet文件夹.例如,文件夹的位置C:\Users\Username\AppData\Local\Microsoft\Windows\Temporary Internet Files
取决于Windows的版本,因此它必须是动态的.
使用此路径: Environment.SpecialFolder.InternetCache
string path = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache)
//for deleting files
System.IO.DirectoryInfo di = new DirectoryInfo(path);
foreach (FileInfo file in di.GetFiles())
{
file.Delete();
}
foreach (DirectoryInfo dir in di.GetDirectories())
{
dir.Delete(true); //delete subdirectories and files
}
Run Code Online (Sandbox Code Playgroud)