public static List<string> GetFile(string path, List<string> FileList, string RelativePath)
        {
            DirectoryInfo dir = new DirectoryInfo(path);
            FileInfo[] fil = dir.GetFiles();
            DirectoryInfo[] dii = dir.GetDirectories();
            foreach (FileInfo f in fil)
            {
                //int size = Convert.ToInt32(f.Length);
                //long size = f.Length;
                FileList.Add(f.FullName);//添加文件路径到列表中
            }
            //获取子文件夹内的文件列表,递归遍历
            foreach (DirectoryInfo d in dii)
            {
                GetFile(d.FullName, FileList, RelativePath);
            }
            return FileList;
        }

 

相关文章:

  • 2022-12-23
  • 2021-10-10
  • 2022-12-23
  • 2021-09-05
  • 2021-06-11
  • 2022-12-23
  • 2022-12-23
  • 2021-07-08
猜你喜欢
  • 2022-01-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2020-10-22
  • 2021-05-27
  • 2022-12-23
相关资源
相似解决方案