public static void GetFiles(string path, List<string> FileList) { DirectoryInfo dir = new DirectoryInfo(path); FileInfo[] fil = dir.GetFiles(); DirectoryInfo[] dii = dir.GetDirectories(); foreach (FileInfo f in fil) { FileList.Add(f.FullName); } //获取子文件夹内的文件列表,递归遍历 foreach (DirectoryInfo d in dii) { GetFiles(d.FullName, FileList); } }
标签:GetFiles,c#,及子,FileList,DirectoryInfo,文件夹,dir From: https://www.cnblogs.com/sunzzhankui/p/16618873.html