function GetFileCount(const Directory: String): Integer; var Sr : TSearchRec; Err : integer; Begin Result := 0; IF not DirectoryExists(Directory) Then Exit; Chdir(Directory + '\'); Err := FindFirst('*.pdf', faAnyFile, Sr) ; While (Err = 0) do Begin Inc(Result); Err:=FindNext(Sr) ; end ; end;
var
Sr : TSearchRec;
Err : integer;
Begin
Result := 0;
IF not DirectoryExists(Directory) Then Exit;
Chdir(Directory + '\');
Err := FindFirst('*.pdf', faAnyFile, Sr) ;
While (Err = 0) do
Begin
Inc(Result);
Err:=FindNext(Sr) ;
end ;
end;