Sign in Join
FPDoc Onlineexperiment

TFileSearcher class

In unit FileUtil

Implements an iterator used to search for files or directories.

Declaration

pascal
TFileSearcher = class(TFileIterator)

Inheritance

  1. TFileSearcher
  2. TFileIterator

Descends from it: TListDirectoriesSearcher TListFileSearcher

Description

TFileSearcher is a TFileIterator descendant used to search for files or directories that match a search mask in a given directory path. TFileSearcher extends the ancestor class with additional properties, methods, and events needed to search and process files or directories on the local file system.

It implements the Search method to perform a search using the specified path(s) and file mask(s).

Use MaskSeparator to specify the delimiter used to separate a list of mask values passed to the method. Use PathSeparator to specify the delimiter used to separate a list of file paths passed to the method.

Use FileAttribute and DirectoryAttribute to specify the file system attributes needed for files or directories considered a match in the Search method. Use FollowSymLink to indicate whether symbolic links on the file system are followed in the Search method.

Use the OnFileFound, OnDirectoryFound, and OnDirectoryEnter event handlers to perform the actions needed for files or directories found using the Search method.

TFileSearcher is the ancestor class for more specialized descendants like TListFileSearcher and TListDirectoriesSearcher.

See also

Properties

MaskSeparatorpublicCharacter used as a delimiter between file masks.
PathSeparatorpublicCharacter used as a delimiter between directory paths.
FollowSymLinkpublicIndicates if a search process directory paths that are symbolic links.
FileAttributepublicFile attribute needed for any file considered a match in the Search method.
DirectoryAttributepublicFile attribute needed for directories considered a match in the Search method.
CircularLinkdetectionpublicEnables or disables detection of circular references when resolving symbolic links.

Methods

DoDirectoryEnterprotectedSignals the OnDirectoryEnter event handler (when assigned).
DoDirectoryFoundprotectedSignals the OnDirectoryFound event handler (when assigned).
DoFileFoundprotectedSignals the OnFileFound event handler (when assigned).
DoQueryFileFoundprotectedPerforms actions needed to accept or reject a file name processed in the Search method.
DoQueryDirectoryEnterprotectedPerforms actions needed to accept or reject a directory name processed in the Search method.
CreatepublicConstructor for the class instance.
SearchpublicSearches for files or directories in the specified path(s) using the specified options.

Events

OnDirectoryFoundpublicEvent handler signalled when a new directory is found in the Search method.
OnFileFoundpublicEvent handler signalled when a file matching the file mask is found in the Search method.
OnDirectoryEnterpublicEvent handler signalled when a new directory is processed in the Search method.
OnQueryFileFoundpublicEvent handler signalled to accept or reject a file name found using the class.
OnQueryDirectoryEnterpublicEvent handler signalled to accept or reject a subdirectory in the Search method.

Inherited

From TFileIterator (7)

FileInfo FileName IsDirectory Level Path Searching Stop

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.