IDirectoryInfo.GetDirectories

Syntax

GetDirectories(Pattern: String): IDirectoryInfoList;

Parameters

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

Description

The GetDirectories method returns information about subdirectories in a directory. A list is filtered according to a filter passed by the Pattern parameter.

Comments

The Pattern character string may contain the following wildcards:

Wildcard D escription
* Zero or more characters.
? Exactly one character.

Characters different from wildcards represent themselves.

Example

Sub UserProc;
Var
    Dir: IDirectoryInfo;
    SubDir: IDirectoryInfoList;
    DirInfo: IDirectoryInfo;
Begin
    Dir := New DirectoryInfo.Attach("c:\Work");
    If Dir.Exists Then
        SubDir := Dir.GetDirectories("*sample*");
        For Each DirInfo In SubDir Do
            Debug.WriteLine("Complete path: " + DirInfo.FullName);
            Debug.WriteLine("Creation date: " + DirInfo.CreationTime.ToShortDateString);
            Debug.WriteLine("Attributes: " + DirInfo.Attributes.ToString);
        End For;
    End If;
    Dispose Dir;
End Sub UserProc;

After executing the example, information about subdirectories of the specified directory that have in its name phrase "sample" is displayed in the development environment console.

See also:

IDirectoryInfo