FileSystem.GetDirectories Method (String)
Returns a collection of strings representing the path names of subdirectories within a directory.
Assembly: Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)
- Type: System.String
Name and path of directory.
The path is not valid for one of the following reasons: it is a zero-length string; it contains only white space; it contains invalid characters; or it is a device path (starts with \\.\).
directory is Nothing or an empty string.
The specified directory does not exist.
The specified directory points to an existing file.
The path exceeds the system-defined maximum length.
A file or directory name in the path contains a colon (:) or is in an invalid format.
The user lacks necessary permissions to view the path.
The user lacks necessary permissions.
The following table lists an example of a task involving the My.Computer.FileSystem.GetDirectories method.
List subdirectories with a specific pattern
The following example returns all the directories in the directory structure that contain the word Logs in their names and adds them to ListBox1.
This example requires that you have a ListBox named ListBox1 on your form.