Program DirectoryControls;
Var
  Path: String[64];
  Ch: Char;

Begin
  TEXTBACKGROUND(1); TEXTCOLOR(14);
  ch := '1';   { initialize loop variable }
  Repeat
    if Upcase(ch) IN ['1', 'M', '2', 'R', '3', 'C','4', 'D', '0', 'Q'] then
      begin
         ClrScr;
         GetDir(0,Path); { Get the current directory of the current drive.
                           Note that 0 for the first variable means the current
                           drive, not A:.  1 means A: and so on.   This is contrary
                           to the manual }
         GOTOXY(23,09);
         TEXTCOLOR(0);TEXTBACKGROUND(7);
         WriteLn(' CURRENT DIRECTORY   IS     ',Path  );
         GOTOXY(23,10); TEXTBACKGROUND(1); TEXTCOLOR(14);
         Writeln('                                  ');
         GOTOXY(32,11); textcolor(15);
         WriteLn(' CHOOSE OPTION:                   ');
         GOTOXY(23,13); textcolor(14);
         WriteLn('  1: Make a directory             ');
         GOTOXY(23,14);
         WriteLn('  2: Remove a directory           ');
         GOTOXY(23,15);
         WriteLn('  3: Change the current directory ');
         GOTOXY(23,16);
         WriteLn('  0: Quit                         ');
         GOTOXY(23,17);
         Writeln('                                  ');
         GOTOXY(32,18);textcolor(15);
         Write(' OPTION: ');
         textcolor(14);
         Read(Kbd,Ch);

         {$I-}
         Case Upcase(Ch) Of
           '1','M': Begin
                      GOTOXY(32,21);
                      WriteLn('Make');
                      GOTOXY(32,22);
                      Write('Make what directory? ');
                      Readln(path);
                      MkDir(Path);
                    End;
           '2','R': Begin
                      GOTOXY(32,21);
                      WriteLn('Remove');
                      GOTOXY(32,22);
                      Write('Remove what directory? ');
                      Readln(path);
                      RmDir(Path);
                    End;
           '3','C': Begin
                      GOTOXY(32,21);
                      WriteLn('Change');
                      Writeln;
                      GOTOXY(32,22);
                      Write('Change to what directory? ');
                      Readln(path);
                      ChDir(Path);
                    End;
           '0','Q': WriteLn('Quit');
           Else
          End; { case }

         {$I+}
         If IOResult<>0 Then
            begin
              GOTOXY(32,24);
              Write('*** Error *** Please Wait: ', path);
              delay(3000);
            end;
       end { if }
     else
       read(kbd, ch)
    Until Upcase(Ch) In ['0','Q', #27];
End.
          