C# get files and write the files full name in txt
时间:2019-10-18 15:53:19
收藏:0
阅读:59
static void GetAllFiles() { string path = "filepath"; var allFiles = Directory.GetFiles(path); string fileName = "file.txt"; using (FileStream fStream = File.Create(fileName)) { } using (FileStream fStream = File.Create("file.txt")) { using (StreamWriter writer = new StreamWriter(fStream, Encoding.UTF8)) { foreach (var file in allFiles) { writer.WriteLine(file); } } } }
原文:https://www.cnblogs.com/Fred1987/p/11698318.html
评论(0)