System.IOUtils.TDirectory.GetFilesEnumerator

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

class function GetFilesEnumerator(const Path: string): IEnumerable<string>;
class function GetFilesEnumerator(const Path: string;
const Predicate: TFilterPredicate): IEnumerable<string>;
class function GetFilesEnumerator(const Path, SearchPattern: string): IEnumerable<string>;
class function GetFilesEnumerator(const Path, SearchPattern: string;
const Predicate: TFilterPredicate): IEnumerable<string>;
class function GetFilesEnumerator(const Path, SearchPattern: string;
const SearchOption: TSearchOption): IEnumerable<string>; overload; static;
class function GetFilesEnumerator(const Path, SearchPattern: string;
const SearchOption: TSearchOption;
const Predicate: TFilterPredicate): IEnumerable<string>; overload; static;
class function GetFilesEnumerator(const Path: string;
const SearchOption: TSearchOption;
const Predicate: TFilterPredicate): IEnumerable<string>; overload; static;

C++

static System::DelphiInterface<System::IEnumerable__1<System::UnicodeString> > __fastcall GetFilesEnumerator(const System::UnicodeString Path)/* overload */;
static System::DelphiInterface<System::IEnumerable__1<System::UnicodeString> > __fastcall GetFilesEnumerator(const System::UnicodeString Path, const _di_TFilterPredicate Predicate)/* overload */;
static System::DelphiInterface<System::IEnumerable__1<System::UnicodeString> > __fastcall GetFilesEnumerator(const System::UnicodeString Path, const System::UnicodeString SearchPattern)/* overload */;
static System::DelphiInterface<System::IEnumerable__1<System::UnicodeString> > __fastcall GetFilesEnumerator(const System::UnicodeString Path, const System::UnicodeString SearchPattern, const _di_TFilterPredicate Predicate)/* overload */;
static System::DelphiInterface<System::IEnumerable__1<System::UnicodeString> > __fastcall GetFilesEnumerator(const System::UnicodeString Path, const System::UnicodeString SearchPattern, const TSearchOption SearchOption)/* overload */;
static System::DelphiInterface<System::IEnumerable__1<System::UnicodeString> > __fastcall GetFilesEnumerator(const System::UnicodeString Path, const System::UnicodeString SearchPattern, const TSearchOption SearchOption, const _di_TFilterPredicate Predicate)/* overload */;
static System::DelphiInterface<System::IEnumerable__1<System::UnicodeString> > __fastcall GetFilesEnumerator(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

Enumerates the files in a given directory.

Use GetFilesEnumerator to obtain an enumerator object, returning the files in a given directory.

There are three forms of the GetFilesEnumerator 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.


Note: GetFilesEnumerator raises an exception if the given path is invalid or the directory does not exist.

See Also

Code Examples