GetDirectories2

Returns a collection of strings representing the path names of sub-directories within a directory.


Syntax

FileSystem.GetDirectories2(Directory, SearchOption)

FileSystem.GetDirectories2(Directory, SearchOption, Wildcard [, Wildcard...])


Parameters


Directory

String, input



Name and path of directory.


SearchOption

Enumeration, input



Whether to include subfolders. Default is SearchTopLevelOnly.


Wildcards

String(s), input



One or more patterns to match names.


Remarks


SearchOption



SearchOption.SearchAllSubDirectories

Search the specified directory and all subdirectories within it. Default.


SearchOption.SearchTopLevelOnly

Search only the specified directory and exclude subdirectories.


SpecialDirectories



AllUsersApplicationData

Gets a path name pointing to the Application Data directory for all users.


CurrentUserApplicationData

Gets a path name pointing to the Application Data directory for the current user.


Desktop

Gets a path name pointing to the Desktop directory.


MyDocuments

Gets a path name pointing to the My Documents directory


MyMusic

Gets a path name pointing to the My Music directory.


MyPictures

Gets a path name pointing to the My Pictures directory.


ProgramFiles

Gets a path name pointing to the Program Files directory.


Programs

Gets a path name pointing to the Programs directory.


Temp

Gets a path name pointing to the Temp directory.


Example

This example shows all the sub-directories of the Flex Terminal Emulator user data directory:


Sub Main()

For Each name In GetDirectories2(SpecialDirectories.MyDocuments & "\FlexSoftware\Flex Terminal Emulator", SearchOption.SearchTopLevelOnly, "*")

Msgbox name

Next

End Sub