Single File System: Virtual File System Delphi Library
for Archive / Backup with Transparent Compression and Strong Encryption


TSingleFileSystem.FindFirst
TSingleFileSystem
Top 


Searches for the first instance of a file name with a given set of attributes in a specified directory of a single file system.

function FindFirst(const Path: string; Attr: Integer; var F: TSearchRec): Integer;

Description
FindFirst searches the directory within a single file system specified by Path for the first file that matches the file name implied by Path and the attributes specified by the Attr parameter. The result is returned in the F parameter. Use the fields of this search record to extract the information needed. FindFirst returns 0 if a file was successfully located, otherwise, it returns an error code.

The Path constant parameter is the directory and file name mask, including wildcard characters. For example, '\test\*.*' specifies all files in the Root:\TEST directory).

The Attr parameter specifies the special files to include in addition to all normal files. Choose from these file attribute constants when specifying the Attr parameter:

Constant   Value      Description

faReadOnly   $00000001   Read-only files
faHidden   $00000002   Hidden files
faSysFile   $00000004   System files
faVolumeID   $00000008   Volume ID files
faDirectory   $00000010   Directory files
faArchive   $00000020   Archive files
faAnyFile   $0000003F   Any file

Attributes can be combined by adding their constants or values. For example, to search for read-only and hidden files in addition to normal files, pass (faReadOnly + faHidden) as the Attr parameter.

Note:
FindFirst allocates resources (memory) which must be released by calling FindClose.


© 2000-2004 AidAim Software LLC Single File System: Single-file Syste