FindFirst searches for the first instance of a file name with a given set of attributes in a specified directory.
Unit
SysUtils
Category
file management routines
function FindFirst(const Path: string; Attr: Integer; var F: TSearchRec): Integer;
Description
FindFirst searches the directory 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 a Windows error code.
The Path constant parameter is the directory and file name mask, including wildcard characters. For example, 'c:\test\*.*' specifies all files in the C:\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:
ConstantValueDescription
faReadOnly$00000001Read-only files
faHidden$00000002Hidden files
faSysFile$00000004System files
faVolumeID$00000008Volume ID files
faDirectory$00000010Directory files
faArchive$00000020Archive files
faAnyFile$0000003FAny 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) the Attr parameter.
Note
The FindFirst function allocates resources (memory) which must be released by calling FindClose.
JE MOET EERST IN DE HELP KIJKEN VOORDAT JE WAT VRAAGT