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

后端 未结 4 615
耶瑟儿~
耶瑟儿~ 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 10:50

    You need to use the overloaded version of Directory.GetFileSystemEntries that specifies whether or not to search subdirectories:

    Dim allDirectories As String() = Directory.GetFileSystemEntries("path", "*", SearchOption.AllDirectories)
    

    Directory.GetFileSystemEntries Method (String, String, SearchOption)

提交回复
热议问题