[Overview][Constants][Types][Classes][Procedures and functions][Index] Reference for unit 'FileUtil' (#lazutils)

SearchAllFilesInPath

SearchAllFilesInPath - searches for all files named Filename in the given SearchPath using the supplied BasePath with the specified Delimiter and the options listed in Flags.

Declaration

Source position: fileutil.pas line 94

function SearchAllFilesInPath(

  const Filename: string;

  const BasePath: string;

  const SearchPath: string;

  const Delimiter: string;

  Flags: TSearchFileInPathFlags

):TStrings;

Arguments

Filename

  

The name of the file for searching.

BasePath

  

The BasePath to be used for the search.

SearchPath

  

The path for searching.

Delimiter

  

The delimiter used between search paths.

Flags

  

Flags specifying how to search: e.g. don't search in base path, case independent search.

Function result

Returns a fully qualified file name for all files that match the supplied criteria, or an empty string if the file is not found.

Description

SearchAllFilesInPath is a TStrings function used to get a list with all file names matching the value in FileName.

SearchAllFilesInPath creates the TStringList instance in the return value when needed. The return value can be Nil if no files or directories were found that match the FileName parameter.

Files or directories stored in the return value are fully-qualified path names, with relative path references resolved to the path in BasePath. If FileName contains an absolute path name, the return value has a single entry with the normalized value for FileName.

SearchPath contains one or more search paths examined in the routine. Each search path is separated by the value in Delimiter.

Flags is a set type which contains zero or more options enabled for the search. It can include values from the TSearchFileInPathFlag enumeration, including:

sffDontSearchInBasePath
Omits the directory in BasePath from the search process. Uses only the directories in SearchPath. When not used, matching files in BasePath are included in the search results.
sffFile
Matching entries must be a file and not a directory. Directory names which match FileName are ignored.
sffExecutable
Matching entries must be an executable file for the platform. Non-executable files are ignored.
sffDequoteSearchPath
Removes ANSI Quotation Marks found in the sanitized name for a matching file.

See also

TSearchFileInPathFlag

  

Flags used to control options used when searching for file(s) in a given path.

TSearchFileInPathFlags

  

Set type used to store values from the TSearchFileInPathFlag enumeration.

FilenameIsAbsolute

  

Determines if the specified value is an absolute file path (not a relative one).

CleanAndExpandFilename

  

Removes whitespace and resolves special characters in the specified file name.

CleanAndExpandDirectory

  

Removes whitespace and resolves special characters in the specified path.

FileExistsUTF8

  

Indicates if the specified UTF-8-encoded file name exists.

DirectoryExistsUTF8

  

Determine if the specified path exists on the local file system.


Version 4.0 Generated 2025-05-03 Home