Platform Core .NET Assemblies API
GetDirectories(String,String,SearchOption) Method
See Also  Send Feedback
Terrasoft.IO Namespace > IDirectory Interface > GetDirectories Method : GetDirectories(String,String,SearchOption) Method
path
The path to search.
searchPattern
The search string to match against the names of subdirectories in path. This parameter can contain a combination of valid literal and wildcard characters, but doesn't support regular expressions.
searchOption
One of the SearchOption values that specifies whether the search operation should include all subdirectories or only the current directory.

Glossary Item Box

Gets an array of directories matching the specified search pattern from the current directory, using a value to determine whether to search subdirectories.

Syntax

 
C#
 
 

Parameters

path
The path to search.
searchPattern
The search string to match against the names of subdirectories in path. This parameter can contain a combination of valid literal and wildcard characters, but doesn't support regular expressions.
searchOption
One of the SearchOption values that specifies whether the search operation should include all subdirectories or only the current directory.

Return Value

An array of the full names (including paths) of the subdirectories that match the specified criteria, or an empty array if no directories are found.

Exceptions

ExceptionDescription
System.UnauthorizedAccessExceptionThe caller does not have the required permission.
System.ArgumentException

path is a zero-length string, contains only white space, or contains one or more invalid characters.

-or-

searchPattern does not contain a valid pattern.

System.ArgumentNullExceptionpath or searchPattern is null.
System.ArgumentOutOfRangeExceptionsearchOption is not a valid System.IO.SearchOption value.
System.IO.IOExceptionpath is a file name.
System.IO.DirectoryNotFoundExceptionThe specified path is invalid (for example, it is on an unmapped drive).

Remarks

The following wildcard specifiers are permitted in searchPattern. * (asterisk) - Zero or more characters in that position. ? (question mark) - Zero or one character in that position. Characters other than the wildcard are literal characters. For example, the searchPattern string "*t" searches for all names in path ending with the letter "t". The searchPattern string "s*" searches for all names in path beginning with the letter "s". searchPattern cannot end in two periods ("..") or contain two periods ("..") followed by '/' or '\', nor can it contain any invalid characters.

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

© Terrasoft 2002-2018.