判断是否存在文件夹

 

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);
}

posted on 2018-11-23 08:34  南方群岛  阅读(221)  评论(0)    收藏  举报

导航