C#递归获取文件目录
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PathClass
{
class Program
{
static void Main(string[] args)
{
fun(@"E:\doNetBook");
Console.ReadKey();
}
public static void fun(string path)
{
string[] fileDirectory = Directory.GetDirectories(path);
foreach (var item in fileDirectory)
{
Console.WriteLine(item);
fun(item);
}
}
}
}