参考网址:https://www.cnblogs.com/zpx1986/p/5584619.html
参数path1为删除文件路径,例如:
private static string _fileDel = "E:/VS_projects/project1/files/WpfApplication2.zip";
DeleteFile(_fileDel);
//删除文件
public bool DeleteFile(string path1)
{
try
{
if (File.Exists(path1))
{
File.Delete(path1);
}
return true;
}
catch
{
return false;
}