How can I perform full recursive directory & file scan?

后端 未结 6 1215
囚心锁ツ
囚心锁ツ 2020-12-11 01:38

here is my code:

    private static void TreeScan(string sDir)
    {
        foreach (string d in Directory.GetDirectories(sDir))
        {
            forea         


        
6条回答
  •  长情又很酷
    2020-12-11 02:20

    Don't reinvent the wheel, use the overload of GetFiles that allows you to specify that it searches subdirectories.

    string[] files 
        = Directory.GetFiles(path, searchPattern, SearchOption.AllDirectories);
    

提交回复
热议问题