Unit PruneU;



interface

{***************************************************************************}

{***************************************************************************}



Procedure Main;



implementation

{***************************************************************************}

{***************************************************************************}

Uses

  Crt,

  FileIO,

  Globals,

  Keyboard,

  MiscSubs;



Procedure Main;

{***************************************************************************}

var

  DeadDir: string;

  DirStat: integer;

  Count: integer;

begin

  if ParamStr(1) <> '' then

    begin

      DeadDir := ParamStr(1);

      DirStat := DirKillDef(DeadDir);

      if DirStat <> 0 then

        begin

          writeln;

          writeln(Beep+'PRUNE of ', DeadDir, ' was unsuccessful!');

          writeln('Error status:  ',DirStat);

        end;

      halt(DirStat);

    end;

  write(MultiChar('-', 80));

  writeln(

    'PRUNE Version 2 by David Croft.  Copyright 1991.  ',

    'Kills sub-directories dead!');

  writeln;

  writeln(

    'PRUNE will delete sub-directories regardless of whether they contain');

  writeln(

    'sub-sub-directories (etc.) or read-only, hidden, or system files!');

  writeln('PRUNE Version 2 can used in a batch file.  ',

    'Example:  PRUNE DeadDir');

  writeln;

  repeat

    writeln('                                Sub-Directories');

    write(MultiChar('-', 80));

    Count := DirDirs('*.*');

    if Count = 0 then

      begin

        writeln('There are no sub-directories to prune.');

        write(MultiChar('-', 80));

        exit;

      end;

    write(MultiChar('-', 80));

    write('Name of the sub-directory to prune [ENTER to quit]:  ');

    readln(DeadDir);

    if DeadDir = '' then

      exit;

    DirStat := DirKillDef(DeadDir);

    if DirStat = 0 then

      writeln('Pruning was sucessful.')

    else

      writeln(Beep+'Unsuccessful!  Error status:  ',DirStat);

    Wait;

  until Forever;

end;



begin

end.