GetDirectories(Path: String; Pattern: String): IStringList;
Path - directory, which contents must be obtained.
Pattern - character string, according to which a list is filtered.
The GetDirectories method returns names of all subdirectories of a directory passed by the Path parameter in accordance with the Pattern filter.
The Pattern character string may contain the following wildcards:
Wildcard | Description |
* | Zero or more characters. |
? | Exactly one character. |
Characters different from wildcards represent themselves.
Sub UserProc(sPath: String; Pattern: String);
Var
SubDir: IStringList;
DirName: String;
Begin
If Directory.Exists(sPath) Then
SubDir := Directory.GetDirectories(sPath, Pattern);
For Each DirName In SubDir Do
Debug.WriteLine(DirName);
End For;
End If;
End Sub UserProc;
On executing the example the existence of a directory specified in the Path parameter is checked. If the directory exists, a list of its subdirectories meeting conditions, passed in the Pattern parameter, is displayed in the development environment console.
See also: