![]() | ||
ПОСЧИТАТЬ КОЛИЧЕСТВО ФАЙЛОВ В ПАПКЕ | ||
function CountFiles(const ADirectory: String): Integer;
var
Rec : TSearchRec;
sts : Integer ;
begin
Result := 0;
sts := FindFirst(ADirectory + '\*.*', faAnyFile, Rec); if sts = 0 then begin repeat if ((Rec.Attr and faDirectory) <> faDirectory) then Inc(Result) else if (Rec.Name <> '.') and (Rec.Name <> '..') then Result := Result + CountFiles(ADirectory + '\'+ Rec.Name); until FindNext(Rec) <> 0; SysUtils.FindClose(Rec); end; end; | ||
procedure TForm1.Button1Click(Sender: TObject);
var f:string;
begin
f:=inttostr(CountFiles('C:\Windows'));
Showmessage(f);
end; | ||
Источник: http://www.delphi3000.com |