A valid path to a directory
A directory specification, including wildcard characters
An array of strings, each element of which is the name of a subdirectory
Returns the names of the subdirectories in a particular directory
path can be either an absolute path (a
complete path from the root directory to the directory whose
subdirectories are to be retrieved) or a relative path (starting from
the current directory to the directory whose subdirectories are to be
path can be either a path on the local
system, the path of a mapped network drive, or a UNC path.
path cannot contain wildcard characters.
searchpattern is specified, the method
returns only those directories whose names match the string, which
can contain wildcard characters. Otherwise,
searchpattern returns the names of all the
subdirectories in the target directory specified by
If the directory specified by
path has no
subdirectories, or if no directories match
searchpattern, an empty array is returned.
The following code displays all subdirectories of c:\ whose names start with the letter P:
Dim sDirs( ) As String Dim i As Integer sDirs = Directory.GetDirectories("c:\", "P*") For i = 0 To UBound(sDirs) Console.WriteLine(sDirs(i)) Next
Since GetDirectories can ...