home *** CD-ROM | disk | FTP | other *** search
/ TopWare Tools / TOOLS.iso / tools / top1318 / gepackt.exe / UTILITY / SOURCE / CDFILE.PAS next >
Encoding:
Pascal/Delphi Source File  |  1991-03-21  |  1.5 KB  |  60 lines

  1. program cdfile;
  2.  
  3.   uses
  4.     autocopy,fdisks,udir,upath,upause,usdir,dos;
  5.  
  6.   var
  7.     fn                                 : string;
  8.     disk                               : string[10];
  9.     path1                              : string;
  10.     b                                  : byte;
  11.  
  12.   procedure sf(s : string; st : boolean);
  13.  
  14.     var
  15.       dir                              : dirtyp;
  16.  
  17.     begin
  18.       if (s+'\'=path1) or (s=path1) then if st then halt else exit;
  19.       with dir do begin
  20.         init;
  21.         sort(sortsize,true);
  22.         read(s);
  23.         write(^m,'':79,^m'bearbeite ',path);
  24.         pause;
  25.         if (s<>'') and selectfilename(fn,false,false) then begin
  26.           if testattr(directory) then s:=path+filename;
  27.           if subdir(s) then halt;
  28.         end
  29.         else begin
  30.           selectfile(0);
  31.           repeat
  32.             pause;
  33.             while not error and not testattr(directory) do deletefile;
  34.             if not error then begin
  35.               sf(path+filename,st);
  36.               deletefile;
  37.             end;
  38.           until error;
  39.           if s='' then sf(copy(path1,1,2)+'\',false);
  40.         end;
  41.         clear;
  42.       end;
  43.     end;
  44.  
  45.   begin
  46.     fn:=paramstr(1);
  47.     if pos(':',fn)>0 then disk:=fn[1]+':\'
  48.     else disk:='';
  49.     path1:=getpath(disk);
  50.     fn:=getfilename(fn);
  51.     sf(disk,true);
  52.     disk:=path1[1];
  53.     b:=pos(disk[1],disks);
  54.     repeat
  55.       inc(b);
  56.       if disks[b]=#0 then b:=0
  57.       else sf(disks[b]+':\',true);
  58.     until false;
  59.   end.
  60.