标签:
1 设置文件保存路径
FolderBrowserDialog fbd = new FolderBrowserDialog(); fbd.ShowDialog(); folderName = fbd.SelectedPath; //获得选择的文件夹路径
2 向文件中写入数据
FileStream fs = new FileStream(savePath,FileMode.Append); StreamWriter sw = new StreamWriter(fs); sw.WriteLine(builder.ToString()); sw.Close(); fs.Close();
3 遍历文件夹查找文件
List<string> saveFlieName = new List<string>(); DirectoryInfo TheFolder = new DirectoryInfo(filePath); //遍历文件 saveFlieName.Clear(); ReadFile rf = new ReadFile(); foreach (FileInfo NextFile in TheFolder.GetFiles()) saveFlieName.Add(NextFile.Name);
标签:
原文地址:http://www.cnblogs.com/braceli/p/5800731.html