public static class FileHelper
{
static public void Exists(string path)
{
if(File.Exists(path))
{
return;
}
Directory.CreateDirectory(Path.GetDirectoryName(path));
File.Create(path).Dispose();
}
}
c# 文件操作 判断路径是否存在,不存在对路径上所有文件进行创建
![](https://img-home.csdnimg.cn/images/20240711042549.png)