System.IOUtils.TDirectory.GetFiles
Delphi
class function GetFiles(const Path: string): TStringDynArray;
class function GetFiles(const Path: string;
const Predicate: TFilterPredicate): TStringDynArray;
class function GetFiles(const Path, SearchPattern: string): TStringDynArray;
class function GetFiles(const Path, SearchPattern: string;
const Predicate: TFilterPredicate): TStringDynArray;
class function GetFiles(const Path, SearchPattern: string;
const SearchOption: TSearchOption): TStringDynArray; overload; static;
class function GetFiles(const Path, SearchPattern: string;
const SearchOption: TSearchOption;
const Predicate: TFilterPredicate): TStringDynArray; overload; static;
class function GetFiles(const Path: string;
const SearchOption: TSearchOption;
const Predicate: TFilterPredicate): TStringDynArray; overload; static;
C++
static System::DynamicArray<System::UnicodeString> __fastcall GetFiles(const System::UnicodeString Path)/* overload */;
static System::DynamicArray<System::UnicodeString> __fastcall GetFiles(const System::UnicodeString Path, const _di_TFilterPredicate Predicate)/* overload */;
static System::DynamicArray<System::UnicodeString> __fastcall GetFiles(const System::UnicodeString Path, const System::UnicodeString SearchPattern)/* overload */;
static System::DynamicArray<System::UnicodeString> __fastcall GetFiles(const System::UnicodeString Path, const System::UnicodeString SearchPattern, const _di_TFilterPredicate Predicate)/* overload */;
static System::DynamicArray<System::UnicodeString> __fastcall GetFiles(const System::UnicodeString Path, const System::UnicodeString SearchPattern, const TSearchOption SearchOption)/* overload */;
static System::DynamicArray<System::UnicodeString> __fastcall GetFiles(const System::UnicodeString Path, const System::UnicodeString SearchPattern, const TSearchOption SearchOption, const _di_TFilterPredicate Predicate)/* overload */;
static System::DynamicArray<System::UnicodeString> __fastcall GetFiles(const System::UnicodeString Path, const TSearchOption SearchOption, const _di_TFilterPredicate Predicate)/* overload */;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.IOUtils.pas System.IOUtils.hpp |
System.IOUtils | TDirectory |
Description
Returns a list of files in a given directory.
Use GetFiles to obtain a list of files in a given directory. The return value of GetFiles is a dynamic array of strings in which each element stores the name of a file (with its path).
There are three forms of the GetFiles method:
- The first form accepts only the path of the directory for which files are enumerated.
- The second form includes a search pattern used when matching file names.
- The third form includes an option specifying whether a recursive mode will be used while enumerating.
All the forms also accept an optional TFilterPredicate parameter, used to filter the results.
The following table lists the parameters expected by this method.
Name | Meaning |
---|---|
Path |
The path of the directory for which files are enumerated. |
SearchPattern |
The mask is used when matching file names (for example, "*.exe" matches all the executable files). You can also use MatchesMask when applying a SearchPattern argument. |
SearchOption |
The directory enumeration mode. Specifies whether the top-level or recursive enumeration mode will be used. |
Predicate |
A routine used to filter out undesired results. |
See Also
Code Examples