c# - 检查文件是否存在,存在则删除- 文件清理工具
public static bool delFile(FileInfo file, string url) { try { if (file == null) { file = new FileInfo(url); } if (!file.Exists) { return true; } file.Delete(); if (!new FileInfo(file.DirectoryName+"/"+file.Name).Exists) { return true; } return false; } catch (Exception e) { Console.WriteLine(e); return false; } }
本文来自博客园,作者:岑惜,转载请注明原文链接:https://www.cnblogs.com/c2g5201314/p/17198190.html
响应开源精神相互学习,内容良币驱除劣币