引用 System.IO
string path = this.TextBox1.Text.Trim();
if (Directory.Exists(path))//判断是否存在
{
Response.Write("已存在");
}
else
{
Response.Write("不存在,正在创建");
Directory.CreateDirectory(path);//创建新路径
}
参考
【1】C# 判断一个目录(路径)是否存在_百度知道
https://zhidao.baidu.com/question/75876340.html
【2】c#如何判断文件夹是否存在_百度经验
http://jingyan.baidu.com/article/95c9d20d527f0eec4e756117.html