List<string> Listfiles = Directory.GetFiles(@"C:UsershuruiDesktopMyFolder","*PJ*",SearchOption.AllDirectories).ToList(); //第一个参数为文件夹名 第二个星号和sql的模糊查询类似
SearchOption.AllDirectories拿取所有符合条件的文件路径,而且不需要我们手动遍历文子文件夹 很强大
List<string> Listfiles = Directory.GetFiles(@"C:UsershuruiDesktopMyFolder","*PJ*",SearchOption.AllDirectories).ToList(); //第一个参数为文件夹名 第二个星号和sql的模糊查询类似
SearchOption.AllDirectories拿取所有符合条件的文件路径,而且不需要我们手动遍历文子文件夹 很强大