IDirectory.GetDirectories

Syntax

GetDirectories(Path: String; Pattern: String): IStringList;

Parameters

Path - a directory content of which should be obtained.

Pattern - a character string according to which a list is filtered.

Description

The GetDirectories method returns names of all subdirectories of a directory passed by the parameter Path in accordance with the filter Pattern.

Comments

Character string Pattern may contain following global characters:

Global character Description
* Zero or more characters.
? Exactly one character.

Characters different from global characters represent themselves.

Example

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;

While executing this example the existence of a directory specified in the parameter Path is checked. If the directory exists, a list of its subdirectories meeting conditions, passed in the parameter Pattern, is displayed in development environment console.

See also:

IDirectory