C# get files and write the files full name in txt
2021-05-19 17:28
标签:str pat filename fstream stream files foreach ati string C# get files and write the files full name in txt 标签:str pat filename fstream stream files foreach ati string 原文地址:https://www.cnblogs.com/Fred1987/p/11698318.html 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);
}
}
}
}
文章标题:C# get files and write the files full name in txt
文章链接:http://soscw.com/essay/87715.html