GetFileSystemEntries(Path: String; Pattern: String): IStringList;
Path - a directory content of which should be obtained.
Pattern - a character string according to which a list is filtered.
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.
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:
If three extension characters are specified in Pattern, files, extension of which has three and more characters, are returned.
quot;*.abcquot; - returns files with extension quot;*.abcquot;, quot;*.abcdquot;, quot;*.abcdequot; and so on.
If one, two or more than three extension characters are specified in Pattern, files with given length of extension are returned.
quot;*.abquot; - returns files with extension quot;*.abquot; only.
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: