c# 文件操作 判断路径是否存在,不存在对路径上所有文件进行创建

 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#,c#,开发语言)