IDirectory.GetFileSystemEntries

Syntax

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

Parameters

Path - directory, which contents must be obtained.

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

Description

The GetFileSystemEntries method returns names of all subdirectories and files that are contained in the directory passed by the Path parameter in accordance with the Pattern filter.

Comments

The Pattern character string may contain the following wildcards:

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

Characters different from wildcards represent themselves. If files extension is specified in a character string, the search is executed as below:

Example

Sub UserProc(sPath: String; Pattern: String);
Var
    Contents: IStringList;
    NameDir: String;
Begin
    If Directory.Exists(sPath) Then
        Contents := Directory.GetFileSystemEntries(sPath, Pattern);
        For Each NameDir In Contents Do
            Debug.WriteLine(NameDir);
        End For;
    End If;
End Sub UserProc;

On executing the example the existence of the directory specified in the Path parameter is checked. If the directory exists, a list of subdirectories and files from the specified directory, that have a phrase "sample" in their name, are displayed in the development environment console.

See also:

IDirectory