Count how many files in a certain folder in delphi

function GetFileCount(Dir: string): integer;
var
  fs: TSearchRec;
begin
  Result := 0;
  if FindFirst(Dir + '\*.htm', faAnyFile - faDirectory - faVolumeID, fs) = 0
    then
    repeat
      inc(Result);
    until
      FindNext(fs) <> 0;
  FindClose(fs);
end;