procedure TForm1.Button1Click(Sender: TObject);
begin
CountFiles('C:\... yourFolder..');
end;
procedure tform1.CountFiles(FilePath: string);
var
SearchRec: TSearchRec;
fileCount: Integer;
begin
fileCount := 0;
if FilePath[Length(FilePath)] <> '\' then FilePath := FilePath + '\';
if FindFirst(FilePath + '*.*', faAnyFile and not faDirectory, SearchRec) = 0 then
begin
Inc(fileCount);
while FindNext(SearchRec) = 0 do
begin
Inc(fileCount);
end;
end;
FindClose(SearchRec);
Form1.Label1.Caption := IntToStr(fileCount) ;
end;