System.IOUtils.TDirectory.GetFileSystemEntries

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

class function GetFileSystemEntries(const Path: string): TStringDynArray;
class function GetFileSystemEntries(const Path: string;  const Predicate: TFilterPredicate): TStringDynArray;
class function GetFileSystemEntries(const Path,  SearchPattern: string): TStringDynArray; overload; static;
class function GetFileSystemEntries(const Path, SearchPattern: string;  const Predicate: TFilterPredicate): TStringDynArray; overload; static;
class function GetFileSystemEntries(const Path: string;  const SearchOption: TSearchOption; const Predicate: TFilterPredicate): TStringDynArray; overload; static;

C++

static System::DynamicArray<System::UnicodeString> __fastcall GetFileSystemEntries(const System::UnicodeString Path)/* overload */;
static System::DynamicArray<System::UnicodeString> __fastcall GetFileSystemEntries(const System::UnicodeString Path, const _di_TFilterPredicate Predicate)/* overload */;
static System::DynamicArray<System::UnicodeString> __fastcall GetFileSystemEntries(const System::UnicodeString Path, const System::UnicodeString SearchPattern)/* overload */;
static System::DynamicArray<System::UnicodeString> __fastcall GetFileSystemEntries(const System::UnicodeString Path, const System::UnicodeString SearchPattern, const _di_TFilterPredicate Predicate)/* overload */;
static System::DynamicArray<System::UnicodeString> __fastcall GetFileSystemEntries(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 and subdirectories in a given directory.

Use GetFileSystemEntries to obtain a list of files and subdirectories in a given directory. The return value of GetFileSystemEntries is a dynamic array of strings in which each element stores the name of a file or subdirectory.

There are two forms of the GetFileSystemEntries method:

  • The first form accepts only the path of the directory for which files and subdirectories are enumerated.
  • The second form includes a search pattern used when matching subdirectory names.

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 subdirectories are enumerated.

SearchPattern

The mask used when matching directory names (for example, "*app" matches all the files and directories ending with "app").

Predicate

A routine used to filter out undesired results.



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

See Also

Code Examples