GetDirectories

Returns a collection of strings representing the path names of subdirectories within a directory.


Syntax

FileSystem.GetDirectories(Directory)

FileSystem.GetDirectories(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 subdirectories of the FlexTerm user data directory:


Sub Main()

For Each name In GetDirectories(SpecialDirectories.MyDocuments & "\FlexSoftware\FlexTerm", SearchOption.SearchTopLevelOnly, "*")

Msgbox name

Next

End Sub