日期:2014-05-19  浏览次数:20818 次

请高手帮忙:在.Net中怎样逐层遍历指定文件夹下层层嵌套的所有子文件夹??(在线等待)
在.Net中使用Directory.GetDirectorys只能得到父文件夹下的一层子文件夹,怎样递归逐层遍历指定文件夹下层层嵌套的所有子文件夹???请大家帮忙,在线等待!!!

------解决方案--------------------
private void ScanPath(string APath)
{
Console.WriteLine(APath);
foreach (string subPath in Directory.GetDirectories(APath))
{
ScanPath(subPath);
}
}

private void button1_Click(object sender, EventArgs e)
{
ScanPath(@ "c:\temp ");
}

------解决方案--------------------
http://www.cnblogs.com/wengjinbao/articles/781870.html
前两天刚遇到过,查到了这篇文章;(按照你递归实现的)
希望对你有帮助;