IDirectory.GetFileSystemEntries

Syntax

GetFileSystemEntries(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 GetFileSystemEntries method returns names of all subdirectories and files that are contained in 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. If files extension is specified in a character string, the search is performed 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;

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

See also:

IDirectory