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 examples of tasks 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.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.