共计 382 个字符,预计需要花费 1 分钟才能阅读完成。
using System;
using System.Collections.Generic;
using System.IO;
private List<string> finded_files = new List<string>();
private void RecursiveGetFiles(string parent_path)
{string[] files = Directory.GetFiles(parent_path);
foreach (string file in files)
{
// 这里能够进行文件的过滤,比方筛选指定的后缀
finded_files.Add(file);
}
string[] paths = Directory.GetDirectories(parent_path);
foreach (string path in paths)
{RecursiveGetFiles(path);
}
}
正文完