判断是否存在文件夹

string path = AppDomain.CurrentDomain.BaseDirectory + "path\\";

if (Directory.Exists(path) == false)//如果不存在就创建log文件夹
{
Directory.CreateDirectory(path);
}

string FileName = path + s_FileName + ".xls"; //文件存放路径
if (System.IO.File.Exists(FileName)) //存在则删除
{
System.IO.File.Delete(FileName);
}

猜你喜欢

转载自www.cnblogs.com/nfqd/p/10005446.html