c#创建文件夹

实例:在c#中 在D盘下面创建一个abc的文件夹,然后在文件夹里面创建一个123.txt的文档

string path = @"D:\abc";
string fileName = "123.txt";
if (!Directory.Exists(path))
{
      Directory.CreateDirectory(path);
}
if (!File.Exists(path + "\\" + fileName))
{
      File.Create(path + "\\" + fileName);
}

posted @ 2013-09-05 17:06  乡香田甜  阅读(333)  评论(0编辑  收藏  举报