System.IOUtils.TDirectory.GetDirectories

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

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

C++

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

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

There are three forms of the GetDirectories method:

  • The first form only accepts the path of the directory for which subdirectories are enumerated.
  • The second form includes a search pattern used when matching subdirectory 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 subdirectories are enumerated.

SearchPattern

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

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: GetDirectories raises an exception if the given path is invalid or the directory does not exist.

See Also

Code Examples