判断文件夹和文件是否存在,并创建

if (Directory.Exists(Path))//以判断路径是否存在的方法判断文件夹是否存在

//if (File.Exists(pPath)) //判断文件是否存在
{
MessageBox.Show("文件夹已存在,请填写不重复的文件夹名称!", "提示");
return;
}
else
{
Directory.CreateDirectory(Path);//创建
}

原文地址:https://www.cnblogs.com/lzh5d/p/7659921.html