home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / HTMIX20.ZIP / DMI.ZIP / DU.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-07-10  |  16.9 KB  |  597 lines

  1. program DirectoryUsage;
  2. {┌──────────────────────────────── INFO ────────────────────────────────────┐}
  3. {│ File    : DU.PAS                                                         │}
  4. {│ Author  : Harald Thunem                                                  │}
  5. {│ Purpose : Gives information about sub-directory sizes.                   │}
  6. {│ Updated : July 10 1992                                                   │}
  7. {└──────────────────────────────────────────────────────────────────────────┘}
  8.  
  9. {────────────────────────── Compiler directives ─────────────────────────────}
  10. {$A+   Word align data                                                       }
  11. {$B-   Short-circuit Boolean expression evaluation                           }
  12. {$E-   Disable linking with 8087-emulating run-time library                  }
  13. {$G+   Enable 80286 code generation                                          }
  14. {$R-   Disable generation of range-checking code                             }
  15. {$S-   Disable generation of stack-overflow checking code                    }
  16. {$V-   String variable checking                                              }
  17. {$X-   Disable Turbo Pascal's extended syntax                                }
  18. {$N+   80x87 code generation                                                 }
  19. {$D-   Disable generation of debug information                               }
  20. {────────────────────────────────────────────────────────────────────────────}
  21.  
  22. uses  Dos,
  23.       Screen,
  24.       NBorder,
  25.       NCommon,
  26.       Keyboard,
  27.       Strings;
  28.  
  29. const MaxDirs    = 500;
  30.       MainAttr   = White+BlueBG;
  31.       TopAttr1   = Magenta+LightWhiteBG;
  32.       TopAttr2   = White+CyanBG;
  33.       BottomAttr1= LightMagenta+LightWhiteBG;
  34.       BottomAttr2= Magenta+LightWhiteBG;
  35.       GraphAttr  = Yellow;
  36.  
  37. type  PDirRec    = ^TDirRec;
  38.       TDirRec    = record
  39.                      Name: string;
  40.                      Size: longint;
  41.                    end;
  42.  
  43. var   DirList    : array[1..MaxDirs] of PDirRec;
  44.       DirFile    : file of TDirRec;
  45.       FileName   : string;
  46.       DriveList  : array[1..26] of char;
  47.       TotalDiskSpace,
  48.       UsedDiskSpace,
  49.       FreeDiskSpace,
  50.       TotalDirSize,
  51.       BiggestDir : longint;
  52.       NumDrives,
  53.       DriveNum,
  54.       NumDirs    : word;
  55.       Drive      : char;
  56.       Path       : string;
  57.  
  58.  
  59. procedure GetDrives;
  60. var i,w: byte;
  61. begin
  62.   NumDrives := 1;
  63.   Port[$70] := $14;
  64.   w := Port[$71];
  65.   w := w and $C0;
  66.   DriveList[NumDrives] := 'A';
  67.   if w=$40 then
  68.   begin
  69.     Inc(NumDrives);
  70.     DriveList[NumDrives] := 'B';
  71.   end;
  72.   Write('Analyzing drives');
  73.   for i := 3 to 26 do
  74.   if DiskSize(i)>-1 then
  75.   begin
  76.     Write('.');
  77.     Inc(NumDrives);
  78.     DriveList[NumDrives] := Chr(i+64);
  79.   end;
  80.   WriteLn;
  81. end;
  82.  
  83.  
  84. procedure GetDirSize(Dir: string; var DirSize: longint);
  85. var Tmp: longint;
  86.     S: SearchRec;
  87. begin
  88.   DirSize := 0;
  89.   Dir := Dir+'\';
  90.   FindFirst(Dir+'*.*',AnyFile,S);
  91.   while DosError=0 do
  92.   if S.Attr and Directory = Directory then
  93.   begin
  94.     if (S.Name<>'.') and (S.Name<>'..') then
  95.     begin
  96.       GetDirSize(Dir+S.Name,Tmp);
  97.       DirSize := DirSize + Tmp;
  98.     end;
  99.     FindNext(S);
  100.   end
  101.   else begin
  102.     DirSize := DirSize + S.Size;
  103.     FindNext(S);
  104.   end;
  105. end;
  106.  
  107.  
  108. function ReadFile(Drive: char): boolean;
  109. begin
  110.   {$I-}
  111.   Assign(DirFile,Drive+':\DUINFO.HT');
  112.   Reset(DirFile);
  113.   {$I+}
  114.   BiggestDir := 0;
  115.   TotalDirSize := 0;
  116.   if IOResult=0 then
  117.   begin
  118.     NumDirs := 0;
  119.     while not Eof(DirFile) do
  120.     begin
  121.       Inc(NumDirs);
  122.       GetMem(DirList[NumDirs],SizeOf(TDirRec));
  123.       Read(DirFile,DirList[NumDirs]^);
  124.       with DirList[NumDirs]^ do
  125.       begin
  126.         if Size > BiggestDir then
  127.           BiggestDir := Size;
  128.         TotalDirSize := TotalDirSize + Size;
  129.       end;
  130.     end;
  131.     Close(DirFile);
  132.     ReadFile:=true;
  133.   end
  134.   else ReadFile:=false;
  135. end;
  136.  
  137.  
  138. procedure EraseList;
  139. var i: word;
  140. begin
  141.   if NumDirs>0 then
  142.   for i := 1 to NumDirs do
  143.     FreeMem(DirList[i],SizeOf(TDirRec));
  144. end;
  145.  
  146.  
  147. procedure QuitProgram;
  148. begin
  149.   EraseList;
  150.   ClrScr;
  151.   SetCursor(CursorUnderline);
  152.   SetBlink;
  153.   OldBorder;
  154.   Halt(1);
  155. end;
  156.  
  157.  
  158. function GetList(Drive: char; DriveNum: byte; ForceScan: boolean): boolean;
  159. var S: SearchRec;
  160.     Scr: pointer;
  161.     i,
  162.     Row,
  163.     Col,
  164.     Size: word;
  165.  
  166.   procedure SaveFile(Drive: char);
  167.   var i: word;
  168.   begin
  169.     {$I-}
  170.     Assign(DirFile,Drive+':\DUINFO.HT');
  171.     Rewrite(DirFile);
  172.     {$I+}
  173.     if IOResult=0 then
  174.       for i := 1 to NumDirs do
  175.         Write(DirFile,DirList[i]^)
  176.     else MessageBox('Error saving info to file !');
  177.   end;
  178.  
  179. begin
  180.   if DiskSize(DriveNum)<0 then
  181.   repeat
  182.     MessageBox('Insert diskette in Drive '+Drive);
  183.   until (DiskSize(DriveNum)>-1) or (Key=Escape);
  184.   if Key=Escape then
  185.   begin
  186.     Key := NullKey;
  187.     GetList := false;
  188.     if NumDirs=0 then QuitProgram;
  189.     Exit;
  190.   end;
  191.   TotalDiskSpace := DiskSize(DriveNum);
  192.   FreeDiskSpace := DiskFree(DriveNum);
  193.   UsedDiskSpace := TotalDiskSpace-FreeDiskSpace;
  194.   if not ForceScan then
  195.   if ReadFile(Drive) then Exit;
  196.   Size := 2*7*30;
  197.   Row := (CRTRows div 2) - 3;
  198.   Col := 25;
  199.   GetMem(Scr,Size);
  200.   StoreToMem(Row,Col,7,30,Scr^);
  201.   NewBox(Row,Col,6,28,White+CyanBG,' ');
  202.   AddShadow(Row,Col,6,28);
  203.   WriteStr(Row+1,Col+4,SameAttr,'Analyzing directory-');
  204.   WriteStr(Row+2,Col+4,SameAttr,'structure on drive '+Drive+':');
  205.  
  206.   NumDirs := 0;
  207.   TotalDirSize := 0;
  208.   BiggestDir := 0;
  209.   FindFirst(Drive+':\*.*',AnyFile,S);
  210.   while DosError=0 do
  211.   if S.Attr and Directory = Directory then
  212.   begin
  213.     WriteStr(Row+4,Col+8,White+CyanBG,'          ');
  214.     WriteC(Row+4,Col+12,SameAttr,S.Name);
  215.     Inc(NumDirs);
  216.     GetMem(DirList[NumDirs],SizeOf(TDirRec));
  217.     DirList[NumDirs]^.Name := S.Name;
  218.     with DirList[NumDirs]^do
  219.     begin
  220.       GetDirSize(Drive+':\'+Name,Size);
  221.       if Size>BiggestDir then
  222.         BiggestDir := Size;
  223.       TotalDirSize := TotalDirSize + Size;
  224.     end;
  225.     FindNext(S);
  226.   end
  227.   else FindNext(S);
  228.   SaveFile(Drive);
  229.   StoreToScr(Row,Col,7,30,Scr^);
  230.   FreeMem(Scr,Size);
  231.   GetList := true;
  232. end;
  233.  
  234.  
  235. procedure SortList(ByName: boolean);
  236. var SubSort,Sorted: boolean;
  237.     Tmp: PDirRec;
  238.     i: word;
  239. begin
  240.   repeat
  241.     Sorted := true;
  242.     for i := 1 to NumDirs-1 do
  243.     begin
  244.       if ByName then
  245.         SubSort := (DirList[i]^.Name < DirList[i+1]^.Name)
  246.       else SubSort := (DirList[i]^.Size >= DirList[i+1]^.Size);
  247.       if not SubSort then
  248.       begin
  249.         Tmp := DirList[i];
  250.         DirList[i] := DirList[i+1];
  251.         DirList[i+1] := Tmp;
  252.         Sorted := false;
  253.       end;
  254.     end;
  255.   until Sorted;
  256. end;
  257.  
  258.  
  259. procedure Background;
  260. var Attr: byte;
  261. begin
  262.   Explode(1,1,CRTRows,80,MainAttr,SingleBorder);
  263.   NewBox(1,1,CRTRows,80,MainAttr,' ');
  264.   Fill(1,1,1,80,TopAttr1,' ');
  265.   WriteC(1,40,TopAttr1,'Directory Usage 2.0');
  266.   Attr := (MainAttr and $0F) or (TopAttr2 and $F0);
  267.   WriteStr(2,1,Attr,#184);
  268.   WriteStr(2,80,Attr,#214);
  269.   WriteStr(2,2,TopAttr2,' Directory      %  |                                             |    Size    ');
  270.   Fill(CRTRows,1,1,80,BottomAttr1,' ');
  271.   WriteStr(CRTRows,2,BottomAttr1,'F1');
  272.   WriteEos(BottomAttr2,' - Help');
  273.   WriteStr(CRTRows,70,BottomAttr1,'Esc');
  274.   WriteEos(BottomAttr2,' - Quit');
  275. end;
  276.  
  277.  
  278. function SizeStr(Size: longint; L: byte): string;
  279. var s: string;
  280. begin
  281.   s := StrL(Size);
  282.   if Length(s)>3 then Insert('.',s,Length(s)-2);
  283.   if Length(s)>7 then Insert('.',s,Length(s)-6);
  284.   if L>11 then
  285.   if Length(s)>11 then Insert('.',s,Length(s)-10);
  286.   while Length(s)<L do
  287.     s := ' ' + s;
  288.   SizeStr := s;
  289. end;
  290.  
  291.  
  292. procedure ShowInfo;
  293. var Scr: pointer;
  294.     Row,
  295.     Col,
  296.     Size: word;
  297. begin
  298.   Size := 2*10*50;
  299.   Row := (CRTRows div 2) - 3;
  300.   Col := 15;
  301.   GetMem(Scr,Size);
  302.   StoreToMem(Row,Col,10,50,Scr^);
  303.   NewBox(Row,Col,9,48,White+MagentaBG,' ');
  304.   AddShadow(Row,Col,9,48);
  305.   Fill(Row,Col,1,48,Magenta+LightWhiteBG,' ');
  306.   WriteC(Row,38,SameAttr,'INFORMATION DRIVE '+Drive+':');
  307.   WriteStr(Row+2,Col+3,SameAttr,'Total disk space     :');
  308.   WriteStr(Row+2,Col+26,SameAttr,SizeStr(TotalDiskSpace,12)+' bytes');
  309.   WriteStr(Row+3,Col+3,SameAttr,'Allocated disk space :');
  310.   WriteStr(Row+3,Col+26,SameAttr,SizeStr(UsedDiskSpace,12)+' bytes');
  311.   WriteStr(Row+4,Col+3,SameAttr,'Available disk space :');
  312.   WriteStr(Row+4,Col+26,SameAttr,SizeStr(FreeDiskSpace,12)+' bytes');
  313.   WriteStr(Row+6,Col+20,Blue+LightWhiteBG,#16+' OK '+#17);
  314.   WriteStr(Row+6,Col+26,Black+MagentaBG,'▄');
  315.   WriteStr(Row+7,Col+21,Black+MagentaBG,'▀▀▀▀▀▀');
  316.   repeat
  317.     InKey(Ch,Key);
  318.   until Key in [Return,Escape];
  319.   StoreToScr(Row,Col,10,50,Scr^);
  320.   FreeMem(Scr,Size);
  321.   Key := NullKey;
  322. end;
  323.  
  324.  
  325. procedure Help;
  326. var Scr: pointer;
  327.     Row,
  328.     Col,
  329.     Size: word;
  330. begin
  331.   Size := 2*18*60;
  332.   Row := (CRTRows div 2) - 8;
  333.   Col := 10;
  334.   GetMem(Scr,Size);
  335.   StoreToMem(Row,Col,18,60,Scr^);
  336.   NewBox(Row,Col,17,58,White+LightBlackBG,' ');
  337.   AddShadow(Row,Col,17,58);
  338.   Fill(Row,Col,1,58,Magenta+LightWhiteBG,' ');
  339.   WriteC(Row,38,SameAttr,'H E L P');
  340.   WriteStr(Row+ 2,Col+3,LightCyan+LightBlackBG,'Directory Usage');
  341.   WriteEos(SameAttr,' will show the amount of disk space');
  342.   WriteStr(Row+ 3,Col+3,SameAttr,'allocated by the main sub-directories. The list of');
  343.   WriteStr(Row+ 4,Col+3,SameAttr,'directories can be scrolled and sorted by name and');
  344.   WriteStr(Row+ 5,Col+3,SameAttr,'size. The info will be saved to the file DUINFO.HT');
  345.   WriteStr(Row+ 6,Col+3,SameAttr,'at the root directory for faster retrieval.');
  346.   WriteStr(Row+ 8,Col+3,LightCyan+LightBlackBG,'Commands');
  347.   WriteStr(Row+ 9,Col+3,Yellow+LightBlackBG,'F1');
  348.   WriteEos(White+LightBlackBG,' - This help');
  349.   WriteStr(Row+10,Col+3,Yellow+LightBlackBG,'F2');
  350.   WriteEos(White+LightBlackBG,' - Re-scan drive');
  351.   WriteStr(Row+11,Col+3,Yellow+LightBlackBG,#24+#25);
  352.   WriteEos(White+LightBlackBG,' - Scroll up/down');
  353.   WriteStr(Row+12,Col+3,Yellow+LightBlackBG,'Esc');
  354.   WriteEos(White+LightBlackBG,'- Quit');
  355.   WriteStr(Row+ 9,Col+33,Yellow+LightBlackBG,'Alt-N');
  356.   WriteEos(White+LightBlackBG,' - Sort by name');
  357.   WriteStr(Row+10,Col+33,Yellow+LightBlackBG,'Alt-S');
  358.   WriteEos(White+LightBlackBG,' - Sort by size');
  359.   WriteStr(Row+11,Col+33,Yellow+LightBlackBG,'Alt-I');
  360.   WriteEos(White+LightBlackBG,' - Drive info');
  361.   WriteStr(Row+12,Col+33,Yellow+LightBlackBG,'Alt-D');
  362.   WriteEos(White+LightBlackBG,' - Change drive');
  363.  
  364.   WriteStr(Row+14,Col+25,Blue+LightWhiteBG,#16+' OK '+#17);
  365.   WriteStr(Row+14,Col+31,Black+LightBlackBG,'▄');
  366.   WriteStr(Row+15,Col+26,Black+LightBlackBG,'▀▀▀▀▀▀');
  367.   repeat
  368.     InKey(Ch,Key);
  369.   until Key=Return;
  370.   StoreToScr(Row,Col,18,60,Scr^);
  371.   FreeMem(Scr,Size);
  372.   Key := NullKey;
  373. end;
  374.  
  375.  
  376. procedure ChangeDrive(var DriveNum: word; var Drive: char);
  377. var Scr: pointer;
  378.     i,
  379.     Current,
  380.     Start,
  381.     Row,
  382.     Col,
  383.     Rows,
  384.     Cols,
  385.     Size: word;
  386. begin
  387.   Cols := 11;
  388.   Rows := 8;
  389.   Size := 2*Rows*Cols;
  390.   Row := (CRTRows div 2)-4;
  391.   Col := 38-(Cols div 2);
  392.   GetMem(Scr,Size);
  393.   StoreToMem(Row,Col,Rows,Cols,Scr^);
  394.   NewBox(Row,Col,Rows-1,Cols-2,White+LightBlackBG,' ');
  395.   AddShadow(Row,Col,Rows-1,Cols-2);
  396.   Fill(Row,Col,1,Cols-2,Magenta+LightWhiteBG,' ');
  397.   WriteC(Row,Col+4,SameAttr,'Drive');
  398.   for i := 1 to NumDrives do
  399.   if i < 5 then
  400.     WriteStr(Row+1+i,Col+4,SameAttr,DriveList[i]);
  401.   Start := 1;
  402.   while DriveNum>(Start+3) do
  403.   begin
  404.     Inc(Start);
  405.     ScrollUp(Row+2,Col+2,Rows-4,Cols-6,White+LightBlackBG);
  406.     WriteStr(Row+5,Col+4,SameAttr,DriveList[Start+3]);
  407.   end;
  408.   Current:=0;
  409.   repeat
  410.     Inc(Current)
  411.   until DriveList[Current] = Drive;
  412.   WriteStr(Row+2+Current-Start,Col+2,Blue+LightWhiteBG,'  '+DriveList[Current]+'  ');
  413.   repeat
  414.     Inkey(Ch,Key);
  415.     WriteStr(Row+2+Current-Start,Col+2,White+LightBlackBG,'  '+DriveList[Current]+'  ');
  416.     case Key of
  417.       UpArrow  : if Current>1 then Dec(Current);
  418.       DownArrow: if Current<NumDrives then Inc(Current);
  419.     end;
  420.     if Current<Start then
  421.     begin
  422.       ScrollDown(Row+2,Col+2,Rows-4,Cols-6,White+LightBlackBG);
  423.       Dec(Start);
  424.     end;
  425.     if Current>(Start+3) then
  426.     begin
  427.       ScrollUp(Row+2,Col+2,Rows-4,Cols-6,White+LightBlackBG);
  428.       Inc(Start);
  429.     end;
  430.     WriteStr(Row+2+Current-Start,Col+2,Blue+LightWhiteBG,'  '+DriveList[Current]+'  ');
  431.   until Key in [Return,Escape];
  432.   if Key=Return then
  433.   begin
  434.     Drive := DriveList[Current];
  435.     DriveNum := Ord(Drive)-64;
  436.   end;
  437.   StoreToScr(Row,Col,Rows,Cols,Scr^);
  438.   FreeMem(Scr,Size);
  439.   Key := NullKey;
  440. end;
  441.  
  442.  
  443. procedure ScrollList;
  444. var Start,
  445.     OldDriveNum,
  446.     Current: word;
  447.     OldDrive: char;
  448.  
  449.   procedure WriteLine(Row: byte; DirNum: word);
  450.   const MaxLine=45;
  451.   var i,LineLength: byte;
  452.       FractionSize: single;
  453.   begin
  454.     with DirList[DirNum]^do
  455.     begin
  456.       WriteStr(Row,3,MainAttr,Name);
  457.       WriteStr(Row,68,MainAttr,SizeStr(Size,11));
  458.       FractionSize := Size / TotalDirSize;
  459.       WriteStr(Row,15,MainAttr,StrRFD(100*FractionSize,5,1));
  460.       FractionSize := Size / BiggestDir;
  461.     end;
  462.     LineLength := Round(FractionSize * MaxLine);
  463.     if LineLength=0 then Exit;
  464.     Fill(Row,22,1,LineLength,GraphAttr,'█');
  465.     for i := 1 to LineLength do
  466.     if (ReadAttr(Row+1,22+i)=MainAttr) or (ReadAttr(Row+1,22+i)=(MainAttr and $F0)) then
  467.     begin
  468.       if ReadChar(Row+1,22+i)='▄' then
  469.         WriteStr(Row+1,22+i,MainAttr and $F0,'█')
  470.       else WriteStr(Row+1,22+i,MainAttr and $F0,'▀');
  471.     end;
  472.     if ReadAttr(Row,22+LineLength)=(MainAttr and $F0) then
  473.       WriteStr(Row,22+LineLength,MainAttr and $F0,'█')
  474.     else WriteStr(Row,22+LineLength,MainAttr and $F0,'▄');
  475.   end;
  476.  
  477.   procedure WritePage(Start: word);
  478.   var i: word;
  479.       FractionSize: single;
  480.   begin
  481.     Fill(3,3,CRTRows-3,76,MainAttr,' ');
  482.     for i := 1 to CRTRows-3 do
  483.     if Start+i-1<=NumDirs then
  484.     with DirList[Start+i-1]^ do
  485.       WriteLine(2+i,Start+i-1);
  486.   end;
  487.  
  488. begin
  489.   Start := 1;
  490.   WritePage(Start);
  491.   Key := NullKey;
  492.   repeat
  493.     InKey(Ch,Key);
  494.     case Key of
  495.       UpArrow  : if Start>1 then
  496.                  begin
  497.                    ScrollDown(3,2,CRTRows-3,78,MainAttr);
  498.                    Dec(Start);
  499.                    WriteLine(3,Start);
  500.                  end;
  501.       DownArrow: if Start<NumDirs then
  502.                  begin
  503.                    ScrollUp(3,2,CRTRows-3,78,MainAttr);
  504.                    Inc(Start);
  505.                    if (Start+CRTRows-5)<NumDirs then
  506.                      WriteLine(CRTRows-1,Start+CRTRows-4);
  507.                    if (Start+CRTRows-6)<NumDirs then
  508.                      WriteLine(CRTRows-2,Start+CRTRows-5);
  509.                  end;
  510.       AltN     : begin
  511.                    SortList(true);
  512.                    Writepage(Start);
  513.                  end;
  514.       AltS     : begin
  515.                    SortList(false);
  516.                    Writepage(Start);
  517.                  end;
  518.       AltI     : ShowInfo;
  519.       AltD     : begin
  520.                    OldDriveNum := DriveNum;
  521.                    OldDrive := Drive;
  522.                    ChangeDrive(DriveNum,Drive);
  523.                    if DriveNum<>OldDriveNum then
  524.                    if GetList(Drive,DriveNum,false) then
  525.                    begin
  526.                      Start := 1;
  527.                      SortList(true);
  528.                      Writepage(Start);
  529.                    end
  530.                    else begin
  531.                      Drive := OldDrive;
  532.                      DriveNum := OldDriveNum;
  533.                    end;
  534.                  end;
  535.       F1       : Help;
  536.       F2       : if Confirm('Re-scan drive '+Drive,true) then
  537.                  begin
  538.                    EraseList;
  539.                    if GetList(Drive,DriveNum,true) then
  540.                      SortList(true);
  541.                    Start := 1;
  542.                    Writepage(Start);
  543.                  end;
  544.       Escape   : if Confirm('Quit program',true) then
  545.                  Key:=Escape;
  546.     end;
  547.   until Key=Escape;
  548.   Key := NullKey;
  549. end;
  550.  
  551.  
  552. procedure ShowOptions;
  553. begin
  554.   WriteLn('Program: Directory Usage 2.0');
  555.   WriteLn('Author : Harald Thunem');
  556.   WriteLn('Purpose: Gives a scrollable list of the usage of each main sub-directories.');
  557.   WriteLn('Usage  : DU [Drive:]');
  558.   WriteLn('         Ex:    DU c:');
  559.   WriteLn('         When no parameter is given, the program uses');
  560.   WriteLn('         the currently active drive.');
  561.   WriteLn('Updated: July 4. 1992');
  562.   Halt(1);
  563. end;
  564.  
  565.  
  566. begin
  567.   WriteLn('Directory Usage 2.0                                          Written by H.Thunem');
  568.   Drive := 'C';
  569.   if ParamCount=0 then
  570.   begin
  571.     GetDir(0,Path);
  572.     Drive := Path[1];
  573.   end
  574.   else begin
  575.     Path := ParamStr(1);
  576.     Path[1] := Upcase(Path[1]);
  577.     if Path[1] in ['A'..'Z'] then
  578.       Drive := Path[1]
  579.     else ShowOptions;
  580.   end;
  581.   NumDirs := 0;
  582.   DriveNum := Ord(Drive)-64;
  583.   if TotalDiskSpace=-1 then
  584.   begin
  585.     WriteLn('Could not find drive ',Drive,'. Halting....');
  586.     Halt(1);
  587.   end;
  588.   GetDrives;
  589.   SetCursor(CursorOff);
  590.   SetIntens;
  591.   NewBorder;
  592.   Background;
  593.   if GetList(Drive,DriveNum,false) then
  594.     SortList(true);
  595.   ScrollList;
  596.   QuitProgram;
  597. end.