var SearchResults : TSearchRec
The FindNext function looks for the next matching file, as defined in the search criteria given by the preceding FindFirst call. The found file details are stored in SearchResults and the return value is 0. Otherwise the return value is negative.
You must have performed a successful FindFirst before calling this routine.
You must call FindClose after calling FindNext for the last time in order to free up resources.
Example code : Search for all Unit1.d* files in the current directory
searchResult : TSearchRec;
begin // Try to find regular files matching Unit1.d* in the current dir
if FindFirst('Unit1.d*', faAnyFile, searchResult) = 0 then
ShowMessage('File name = '+searchResult.Name);
ShowMessage('File size = '+IntToStr(searchResult.Size));
until FindNext(searchResult) <> 0; // Must free up resources used by these successful finds