How to get the list of all directories and subdirectories in a specified path using vb.net

后端 未结 4 609
耶瑟儿~
耶瑟儿~ 2021-01-28 10:27

My directory structure is like below.

Parent directory
---Sub directory 1 ---Sub directory 2 ------Sub directory2a ------Sub directory2b ---Sub directory 3

4条回答
  •  被撕碎了的回忆
    2021-01-28 11:00

    just use something like this:

    Dim result = System.IO.Directory.EnumerateDirectories(path, "*", System.IO.SearchOption.AllDirectories)
    

    the trick is the SearchOption.AllDirectories

    BTW: you can do the same with your GetFileSystemEntries-Method

提交回复
热议问题