You are reading help file online using chmlib.com
|
function FindFirst(const FileName: String; var FindRec: TFindRec): Boolean;
Retrieves information about the first file matching the wildcard specified by FileName. Returns True if successful.
TFindRec is defined as:
TFindRec = record Name: String; // name of the found file (no path) Attributes: LongWord; // file attributes SizeHigh: LongWord; // size of the file, upper 32 bits SizeLow: LongWord; // size of the file, lower 32 bits FindHandle: THandle; // used internally end;
Valid file attributes are:
FILE_ATTRIBUTE_READONLY FILE_ATTRIBUTE_HIDDEN FILE_ATTRIBUTE_SYSTEM FILE_ATTRIBUTE_DIRECTORY FILE_ATTRIBUTE_ARCHIVE FILE_ATTRIBUTE_DEVICE FILE_ATTRIBUTE_NORMAL FILE_ATTRIBUTE_TEMPORARY FILE_ATTRIBUTE_SPARSE_FILE FILE_ATTRIBUTE_REPARSE_POINT FILE_ATTRIBUTE_COMPRESSED FILE_ATTRIBUTE_OFFLINE FILE_ATTRIBUTE_NOT_CONTENT_INDEXED FILE_ATTRIBUTE_ENCRYPTED
If FindFirst returns True, call FindNext to enumerate the rest of the files, and then FindClose.
The following example counts the number of files in the Windows System directory.
var FilesFound: Integer; FindRec: TFindRec; begin FilesFound := 0; if FindFirst(ExpandConstant('{sys}\*'), FindRec) then begin try repeat // Don't count directories if FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0 then FilesFound := FilesFound + 1; until not FindNext(FindRec); finally FindClose(FindRec); end; end; MsgBox(IntToStr(FilesFound) + ' files found in the System directory.', mbInformation, MB_OK); end;
You are reading help file online using chmlib.com
|