< -->

Program DirectoriesOnDiskette;
Uses DOS;
var
  S : String;
  i : Longint;
  OldDir : String;
var
  DirInfo: SearchRec;
  NDirsRoot : Word;
  NErr : Byte;
Function Randstr : String;
var
  S : String;
  Ch : Char;
begin
  S := '';
  Repeat
   Ch := Char(Random(256));
   if Ch in['A'..'Z'] then
     S := S + ch;
  Until Length(S)=8;
  RandStr := S;
end;
begin
  NErr := 0;
  Randomize;
  GetDir(0, OldDir);
  WriteLn(OldDir);
  {$I-}
  ChDir('A:');
  Repeat
    ChDir('..');
  Until IOResult<>0;
  GetDir(0, S);
  WriteLn(S);
{  Repeat
    S := RandStr;
    MkDir(S);
  Until IOResult<>0;}
  Repeat
    Repeat
      ChDir('..');
    Until IOResult<>0;
   Repeat
    NDirsRoot := 0;
    FindFirst('*.*', Directory, DirInfo);
    While DosError = 0 do
    begin
      FindNext(DirInfo);
      inc(NDirsRoot);
    end;
    FindFirst('*.*', Directory, DirInfo);
    if NDirsRoot > 2 then
    begin
     for i := 2 to Random(NDirsRoot) do
       FindNext(DirInfo);
     ChDir(FExpand(DirInfo.Name));
    end;
   Until (NDirsRoot<=2);
    GetDir(0, S);
    if NErr <> 0 then Write('/:|_&_|:\');
    WriteLn('|||||', FExpand(DirInfo.Name));
    for i := 1 to Random(7) do
    begin
     S := RandStr;
     MkDir(S);
     WriteLn('> ', S);
    end;
   if IOResult=0 then NErr := 0 else inc(NErr);
  Until NErr >= 10;
  {$I+}
  ChDir(OldDir);
end.

Назад