string path = @"D:\abc"; string fileName = "123.txt";
if (!Directory.Exists(path)) { Directory.CreateDirectory(path); }
if (!File.Exists(path + "\\" + fileName)) { File.Create(path + "\\" + fileName); }
C#编程-22:判断文件是否存在并创建文件(夹)_彭世瑜_新浪博客
阅读 18
2022-04-02
string path = @"D:\abc"; string fileName = "123.txt";
if (!Directory.Exists(path)) { Directory.CreateDirectory(path); }
if (!File.Exists(path + "\\" + fileName)) { File.Create(path + "\\" + fileName); }
相关推荐
精彩评论(0)