C# IO 创建目录及文件

            string path = @"c:\wtqCreate";
             string pathTxt = path + @"\my.txt";
             if (Directory.Exists(path))
             {
                  
                 Directory.Delete(path,true);
                 Directory.CreateDirectory(path);
                 using (StreamWriter sw = File.CreateText(pathTxt))
                 {
                     sw.WriteLine("my name is wtq");
                     sw.WriteLine("and what's your name");
                     sw.WriteLine("my name is wwttqq");
                     sw.WriteLine("I Can do everyThing");
                 }
             }        

  

原文地址:https://www.cnblogs.com/ShaYeBlog/p/2693732.html