{************ }
uses Dos;
var total,totald:longint;
 Procedure SearchDisk(mask,cat:string);
 var DirInfo: SearchRec;
 CurDir:string;
 begin
 GetDir(0,CurDir);
 chdir(cat);
 FindFirst(mask, AnyFile, DirInfo);
 while DosError = 0 do
 begin
 if (DirInfo.Name<>'.') and (DirInfo.Name<>'..') then
 begin
 WriteLn(' fn:',DirInfo.Name:14,' Cat:',cat);
 if (DirInfo.Attr = $10) then
 begin { directory found }
 inc(totald);
 if (cat='\')
 then SearchDisk(mask,'\'+DirInfo.Name)
 else SearchDisk(mask,cat+'\'+DirInfo.Name);
 end
 else { file found }
 inc(total);
 end;
 FindNext(DirInfo);
 end;
 chdir(CurDir);
 end;
begin
total:=0; totald:=0;
SearchDisk('*.*','\');
writeln('Found: ',totald:5,' directories.');
writeln(' ',total:5,' files.');
end.

Оценка - 1.0 (10)

2010-10-25 • Просмотров [ 2054 ]