读取服务器或者本地的文件夹下面的文件
作者:互联网
public class UnitTest1 { [Fact] public void Test1() { List<string> array = new List<string>(); DirectoryInfo theFolder = new DirectoryInfo(@"G:\检验批测试\"); DirectoryInfo[] dirInfo = theFolder.GetDirectories(); //遍历文件夹 foreach (DirectoryInfo NextFolder in dirInfo) { // this.listBox1.Items.Add(NextFolder.Name); FileInfo[] fileInfo = NextFolder.GetFiles(); foreach (FileInfo NextFile in fileInfo) //遍历文件 array.Add(NextFile.Name); } } }
标签:NextFile,DirectoryInfo,NextFolder,Add,文件夹,Name,服务器,array,读取 来源: https://www.cnblogs.com/liguix/p/11084176.html