function FileNum(const Path: string): Integer;<br>var<br> f: TSearchRec;<br> Ret: Integer;<br>begin<br> Result:=0;<br> Ret:=FindFirst(Path+'/*.*', faAnyFile, f);<br> while Ret=0 do<br> begin<br> if (f.Name<>'.') and (f.Name<>'..') then<br> begin<br> Inc(Result);<br> if (f.Attr and faDirectory)>0 then<br> Result:=Result+FileNum(Path+'/'+f.Name)<br> end;<br> FindNext(f)<br> end<br>end;