home *** CD-ROM | disk | FTP | other *** search
-
- program FindDuplicateFiles;
-
- { Version 1.0 by Karson Morrison
- ----------------------------------------------------------------
- Version 1.2 by Kenn Flee, Aug. 1985, Madison WI
- Changes: (May be found by Searching for "*2*")
- 1. Add automatic size listing when printing.
- 2. Change 24-hr time in listing to 12-hr am/pm.
- (Like DOS Directory listing)
- 3. Added filler 0 in day portion of date.
- ----------------------------------------------------------------
-
- Anyone who modifies this program place your name and the new
- version number by it. Place a comment before and after your
- changes and place the version number as part of those comments.
-
- This is a program to list out all of the files on a disk
- sorted in file order. It will also tell you of any duplicate
- files within different directories.
-
- A command line is used as input if entered else the default
- drive is used.
-
- This program requires Turbo Pascal 2.0 and the Turbo Toolbox
- pascal program SORT.BOX. The .COM version has already been
- compiled with the SORT in it.
-
- This program was written by Karson W. Morrison
- RD. 1, Box 531,
- Ringoes, NJ. 08551
- (201) 788-1846
-
- I used info picked up from a bulletin board for the routines
- to get system date and time. That info was created by
- Jon Gray of the IBM PC USERS GROUP Milwaukee. It did have a
- bug though that would only work with months of 2 digits (now fixed by
- me).
-
- I also used routines provided by Borland for the reading of directories.
- This info was provided in their Turbo Tutor package.
-
- A lot of hours went into this program please do not revise it
- and leave out the credit that I have done most of the work.
-
- Every time I turned around I was trying to delete some of the
- files on my hard disk because I was always ending up with only
- 300 - 400 K left. I kept thinking there must be an easier way
- to know if there were duplicate files.
-
- This is the result!
- }
-
- const
- Max_dir = 200; { Max number of directory entries }
- { it can be upped }
- type
- DirRec = { My Sort Record }
- record
- FileNme : string[14];
- FileDir : string[36];
- FileAttributes : string[5];
- FileMO : integer;
- FileDA : integer;
- FileYR : integer;
- FileHR : integer;
- FileMN : integer;
- FileSize : string[8]; { Not enough room for this on the screen }
- { *2* But will fit on print option! *** }
- end;
- CommandString = string[3]; { Command Line }
- Char12arr = string [ 50 ];
- String20 = string [ 20 ];
- RegRec = { The data to pass to DOS }
- record
- AX, BX, CX, DX, BP, SI, DI, DS, ES, Flags : Integer;
- end;
-
- var
- InputString : CommandString; { Command Line }
- CL : CommandString absolute cseg:$80;
- FilVar : text; { Is it CON: or LST: }
- DirectryRec : DirRec;
- Print,
- FirstTime,
- NotDir : Boolean;
- Regs : RegRec;
- DTA : array [ 1..43 ] of Byte;
- Mask : array [ 1..50 ] of Char;
- NamR : String20;
- timestr : string[11];
- datestr : string[15];
- Error, I : Integer;
- Buffer,
- Buffer1,
- Buffer2 : String [50];
- DirTable : Array [ 1..Max_dir ] of string[50];
- E, E_use,
- A, B, C,
- PageNo : integer;
- OldName : string [14];
- OldDir : string [36];
- OldAttr : string[5];
- OldMO,
- OldDA,
- OldYR,
- OldHR,
- OldMN : integer;
- OldFileSize : String[9]; { *2* Need it later *** }
- WrkMN : string[2];
- ScreenLine : String[29];
- WorkName : string[14];
- Option : string[1];
- MatchFound : Boolean;
- ScreenLines : integer;
- Temp : string[1];
- SortResult,
- FileDateDos,
- FileHourDos,
- FileYear,
- FileMonth,
- FileDay,
- FileHour,
- FileMinute,
- FileWork,
- Hours,
- NumberRecs : integer;
- Size : real; { *2* Add For Print Option *** }
- ap : Char; { *2* am/pm in listings *** }
-
- {$ISORT.BOX} { This is from Borland in their }
- { Toolbox package }
- procedure date;
- const
- montharr : array [1..12] of string[3] =
- ('Jan','Feb','Mar','Apr','May',
- 'Jun','Jul','Aug','Sep','Oct','Nov','Dec');
-
- var
- regs:regrec;
- month, day:string[2];
- year:string[4];
- dx, cx, result, tmpmonth:integer;
-
- begin
- with regs do
- begin
- ax:= $2a shl 8;
- end;
- msdos (regs);
- with regs do
- begin
- str(cx:4, year);
- str(dx shr 8:2, month);
- str(dx mod 256:2, day);
- end;
- if month[1] = ' ' then month[1] := '0';
- val (month, tmpmonth, result);
- datestr:= day + '-' + montharr[tmpmonth] + '-' + year
- end; { procedure date }
-
- procedure time;
- var
- regs:regrec;
- ah, al, ch, cl, dh:byte;
- hour, min, sec, ampm:string[2];
- tmptime, result:integer;
-
- begin
- ah := $2c;
- with regs do
- begin
- ax := ah shl 8 + al;
- end;
- intr($21,regs);
- with regs do
- begin
- str(cx shr 8:2, hour);
- str(cx mod 256:2, min);
- str(dx shr 8:2, sec);
- end;
- if (hour > '12') then
- begin
- val (hour, tmptime, result);
- tmptime:= tmptime - 12;
- str (tmptime:2, hour);
- ampm:= 'pm'
- end
- else
- ampm:= 'am';
- if (min[1] = ' ') then
- min[1]:= '0';
- if (sec[1] = ' ') then
- sec[1]:= '0';
- timestr := hour + ':' + min + ':' + sec + ' ' + ampm;
- end; { procedure time }
-
- procedure SetUpDTA;
- begin
- Regs.AX := $1A00; { Function used to set the DTA }
- Regs.DS := Seg(DTA); { store the parameter segment in DS }
- Regs.DX := Ofs(DTA); { " " " offset in DX }
- MSDos(Regs); { Set DTA location }
- Error := Regs.AX and $FF;
- end;
-
- procedure ReadFirst;
- begin
- Regs.AX := $4E00; { Get first directory entry }
- Regs.DS := Seg(Mask); { Point to the file Mask }
- Regs.DX := Ofs(Mask);
- Regs.CX := 23; { Store the option }
- MSDos(Regs); { Execute MSDos call }
- Error := Regs.AX and $FF; { Get Error return }
- end;
-
- procedure ReadNext;
- begin
- Error := 0;
- Regs.AX := $4F00; { Function used to get the next }
- { directory entry }
- Regs.CX := 23; { Set the file option }
- MSDos( Regs ); { Call MSDos }
- Error := Regs.AX and $FF; { get the Error return }
- end;
-
- procedure SetUpNamR; { Get the file name from the directory }
- begin
- repeat
- NamR[I] := Chr(Mem[Seg(DTA):Ofs(DTA)+29+I]);
- I := I + 1;
- until not (NamR[I-1] in [' '..'~']) or (I>20);
-
- NamR[0] := Chr(I-1); { set string length because assigning }
- { by element does not set length }
- end;
-
- procedure Set_up_Dir_Chg; { Get a new directory from the table }
- begin
- Write('.'); { This puts a . on the screen each }
- E_use := E_Use + 1; { time a directory changes }
- Buffer := DirTable[E_use];
- Buffer1 := DirTable[E_use];
- Buffer[ length( Buffer ) + 1 ] := '\'; { Move in }
- Buffer[ length( Buffer ) + 2 ] := '?'; { Default }
- Buffer[ length( Buffer ) + 3 ] := '?'; { For }
- Buffer[ length( Buffer ) + 4 ] := '?'; { Files }
- Buffer[ length( Buffer ) + 5 ] := '?';
- Buffer[ length( Buffer ) + 6 ] := '?';
- Buffer[ length( Buffer ) + 7 ] := '?';
- Buffer[ length( Buffer ) + 8 ] := '?';
- Buffer[ length( Buffer ) + 9 ] := '?';
- Buffer[ length( Buffer ) + 10 ] := '.';
- Buffer[ length( Buffer ) + 11 ] := '?';
- Buffer[ length( Buffer ) + 12 ] := '?';
- Buffer[ length( Buffer ) + 13 ] := '?';
- Buffer[ length( Buffer ) + 14 ] := Chr( 0 );
- Buffer[0] := Chr( length(Buffer) + 14 );
- if length(Buffer1) = 1 then Buffer1 := '';
- for I := 1 to length(Buffer) do
- Mask[I] := Buffer[I];
- end;
-
- procedure FindDate; { Translate the Date from the Disk to }
- begin { Something readable }
- FileMonth := 0; { yyyyyyymmmmddddd in bits}
- FileDay := 0;
- FileDateDos := MemW[Seg(DTA):Ofs(DTA)+24];
- FileYear := FileDateDos shr 9; { drop off the last 9 positions }
- FileYear := FileYear + 80; { years are added to base year of 1980 }
- FileWork := FileDateDos shl 7; { drop off the first 7 positions }
- FileMonth := FileWork shr 12; { now move it back to the right }
- FileWork := FileDateDos shl 11; { drop off the left 11 positions }
- FileDay := FileWork shr 11; { now move back to the right }
- end;
-
- procedure FindTime; { Get the time and put it in a format that }
- begin { we can use. The Dos Format in bits is }
- FileHour := 0; { hhhhhmmmmmmsssss }
- FileMinute := 0;
- FileHourDos := MemW[Seg(DTA):Ofs(DTA)+22];
- FileHour := FileHourDos shr 11; { Shift it around so the minutes and }
- FileWork := FileHourDos shl 5; { seconds disappear }
- FileMinute := FileWork shr 10;
- end;
-
- PROCEDURE FindSize; { *2* Added so can display on print option *** }
- Begin
- With DirectryRec do begin
- Size := (Mem[Seg(DTA):Ofs(DTA)+28] * 65536.0) +
- (Mem[Seg(DTA):Ofs(DTA)+27] * 256.0) +
- (Mem[Seg(DTA):Ofs(DTA)+26] * 1.0);
- Str(Size:8:0,FileSize);
- End;
- End;
-
- procedure PrintDTA;
- var
- FileAttr : Byte;
- begin
- FileAttr := Byte(Mem[Seg(DTA):Ofs(DTA)+21]);
- if FileAttr > 31 then { File Not Archived }
- begin
- FileAttr := FileAttr - 32;
- end;
- DirectryRec.FileAttributes := ' '; { Make it all spaces }
- if FileAttr > 15 then { This is a directory entry }
- begin { Let's do it to it }
- FileAttr := FileAttr - 16;
- E := E + 1;
- Buffer2 := Buffer1;
- A := Length(Buffer2) + 1;
- B := Length(NamR);
- C := 1;
- Buffer2[A] := '\';
- repeat
- A := A + 1;
- Buffer2[A] := NamR[C];
- C := C + 1;
- until C > B;
- Buffer2[0] := Chr(A - 1);
- DirectryRec.FileAttributes[4] := '*'; { Sub Directry }
- DirTable[ E ] := Buffer2;
- end;
- if FileAttr > 7 then
- begin
- (* DirectryRec.FileAttributes[4] := 'V'; { Volume Label } Volume labels *)
- FileAttr := FileAttr - 8 { don't come back on this call }
- end;
- if FileAttr > 3 then
- begin
- DirectryRec.FileAttributes[3] := 'S'; { System File }
- FileAttr := FileAttr - 4;
- end;
- if FileAttr > 1 then
- begin
- DirectryRec.FileAttributes[2] := 'H'; { Hidden File }
- FileAttr := FileAttr - 2;
- end;
- if FileAttr > 0 then
- begin
- DirectryRec.FileAttributes[1] := 'R'; { Read Only }
- end;
- end;
-
- procedure FormatAndReleaseSort; { Yep that is what it is }
- begin
- DirectryRec.FileNme := ' '; { Blank it out }
- DirectryRec.FileNme := NamR;
- DirectryRec.FileDir := Buffer1;
- DirectryRec.FileNme[0] := Chr(13); { Now make it 13 long }
- FindDate; { Make date readable }
- FindTime; { Time also }
- DirectryRec.FileMO := FileMonth; { Complete setting up }
- DirectryRec.FileDA := FileDay; { Sort Record }
- DirectryRec.FileYR := FileYear;
- DirectryRec.FileHR := FileHour;
- DirectryRec.FileMN := FileMinute;
- FindSize; { *2* Added for print option }
- SortRelease(DirectryRec); { Let'er go! }
- End;
-
-
- procedure Inp; { ReadDirs this procedure is forward declared in SORT.BOX }
- begin { This reads the directories and releases }
- { to the sort }
- NotDir := True;
- E := 1; E_Use := 0;
- Buffer1 := ''; Buffer2 := Buffer; DirTable[E] := Buffer;
- Buffer[ length(Buffer) + 1 ] := Chr(0);
- Buffer[0] := chr(length(buffer));
- FillChar(DTA,SizeOf(DTA),0); { Initialize the DTA buffer }
- FillChar(Mask,SizeOf(Mask),0); { Initialize the mask }
- FillChar(NamR,SizeOf(NamR),0); { Initialize the file name }
- SetUpDTA;
- Error := 0;
- While E_Use < E do
- begin
- Set_Up_Dir_Chg;
- ReadFirst; { This does the first read for a directory }
- if (Error = 0) then
- begin
- I := 1; { initialize 'I' to the first element }
- SetUpNamR;
- if NamR[1] = '.' then NotDir := False;
- if NotDir and (Error = 0) then
- begin
- PrintDTA; { This gets the file attributes }
- FormatAndReleaseSort; { Build the record }
- end;
- end;
- while (Error = 0) do begin
- NotDir := True;
- ReadNext; { This reads other entries in directory but }
- if (Error = 0) then { the first }
- begin
- I := 1;
- SetUpNamR;
- if NamR[1] = '.' then NotDir := False; { Is it a dot directory }
- if NotDir and (Error = 0) then { No it is not }
- begin
- PrintDTA;
- FormatAndReleaseSort;
- end;
- end;
- end;
- end;
- Writeln; { All done reading the directories }
- Writeln('Sorting the Directory Data');
- end; { End of procedure Inp }
-
- function Less; { this boolean function hass two parameters, X and Y }
- { and is forward declared in SORT.BOX }
- var
- FirstDir : DirRec absolute X;
- SecondDir : DirRec absolute Y;
- begin { this tells the sort which of the }
- Less := (FirstDir.FileNme < SecondDir.FileNme) or { two entries are }
- ((FirstDir.FileNme = SecondDir.FileNme) and { first and which }
- (FirstDir.FileDir < SecondDir.FileDir)); { is second }
- end;
-
- procedure SetUpOldArea; { We need to keep the old }
- begin { Stuff around to see if }
- OldName := DirectryRec.FileNme; { Matches the new stuff }
- OldDir := DirectryRec.FileDir; { This is used for the duplicate }
- OldAttr := DirectryRec.FileAttributes; { compares }
- OldDA := DirectryRec.FileDA;
- OldMO := DirectryRec.FileMO;
- OldYR := DirectryRec.FileYR;
- OldHR := DirectryRec.FileHR;
- OldMN := DirectryRec.FileMN;
- OldFileSize := DirectryRec.FileSize; { *2* Print FileSize if .LST *** }
- end;
-
- procedure FixMinute; { Make the time readable }
- begin { put a 0 in front of one }
- if length(WrkMN) = 1 then { character minutes }
- begin
- WrkMN[2] := WrkMN[1];
- WrkMN[1] := '0';
- WrkMN[0] := Chr(2);
- end;
- end;
-
- procedure HeadingDupe; { Headings for the reports }
- begin
- PageNo := PageNo + 1;
- Writeln(FilVar,'');
- Write(FilVar,' Directory list for DUPLICATE files. ',Datestr,' ',Timestr);
- Writeln(FilVar,' Page ',PageNo);
- Writeln(FilVar,' * = Sub Dir: R = Read only; H = Hidden: S = System');
- Write(FilVar,' Files ');
- If Print then Write(FilVar,' Size '); { *2* For print option *** }
- Writeln(FilVar,' Date Time Directory ');
- WriteLn(FilVar,'');
- end;
-
- procedure HeadingAll; { Heading for the reports }
- begin
- PageNo := PageNo + 1;
- Writeln(FilVar,'');
- Write(FilVar,' Directory list for ALL files. ',Datestr,' ',Timestr);
- Writeln(FilVar,' Page ',PageNo);
- Writeln(FilVar,' * = Sub Dir: R = Read only: H = Hidden: S = System');
- Write(FilVar,' Files ');
- If Print then Write(FilVar,' Size '); { *2* For print option *** }
- Writeln(FilVar,' Date Time Directory ');
- WriteLn(FilVar,'');
- end;
-
- procedure OutP; { this procedure is forward declared in SORT.BOX }
- begin { This takes the sorted data and creates }
- ClrScr; { the required reports (Screen or Paper) }
- OldName := ' '; { Clear out the field }
- NumberRecs := 0;
- Buffer[3] := chr(0); { Shorten the drive identifier here }
- Buffer[0] := chr(2);
- if print then
- begin
- GoToXY(30,15); { This gives you something to look at on the }
- Write('Printing the Report'); { Screen }
- end;
- if Option = '1' then
- HeadingAll { Do you want all the Directories }
- else
- HeadingDupe; { or just the duplicate }
- repeat
- SortReturn(DirectryRec); { Hay it's back, just like magic }
- NumberRecs := NumberRecs + 1;
- if Option = '1' then { You want them all }
- begin
- if ((print) and (ScreenLines > 50))
- or ((not print) and (ScreenLines > 18)) then
- begin
- if print then
- begin
- Writeln(FilVar,#$0C);
- end
- else
- begin
- Write(' More');
- Read(Kbd,Temp);
- ClrScr;
- end;
- HeadingAll;
- ScreenLines := 0;
- end;
- Write(FilVar,DirectryRec.FileAttributes);
- Write(FilVar,DirectryRec.FileNme,' '); { Let's show'em what we found }
- If Print then Write(FilVar,DirectryRec.FileSize,' '); { *2* Print Size if .LST *** }
- Str(DirectryRec.FileDA, WrkMN); { *2* Use existing procedure to fix Day *** }
- FixMinute; { *2* }
- Write(FilVar,DirectryRec.FileMO:2,'/',WrkMN,'/',DirectryRec.FileYR);
- Str(DirectryRec.FileMN, WrkMN);
- FixMinute;
- { *2* Following to get rid of 24 hour time *** }
- If DirectryRec.FileHR >= 12 then ap := 'p' else ap := 'a';
- If DirectryRec.FileHR > 12 then DirectryRec.FileHR := DirectryRec.FileHR -12;
- If DirectryRec.FileHR = 0 then DirectryRec.FileHR := 12;
- { *2* End time changes *** }
- Write(FilVar,' ',DirectryRec.FileHR:2,':',WrkMN);
- Write(FilVar,ap); { *2* Add am/pm indicator *** }
- Write(FilVar,' ');
- if length(InputString) > 0 then
- begin
- if length(DirectryRec.FileDir) > 3 then
- Writeln(FilVar,DirectryRec.FileDir)
- else
- Writeln(FilVar,buffer,'\')
- end
- else
- if length(DirectryRec.FileDir) > 1 then
- Writeln(FilVar,DirectryRec.FileDir)
- else
- Writeln(FilVar,'\');
- ScreenLines := ScreenLines + 1;
- end
- else { You want just the Duplicate entries }
- begin
- WorkName := DirectryRec.FileNme;
- if OldName < WorkName then { its not duplicate }
- begin
- SetUpOldArea;
- if MatchFound then
- begin
- MatchFound := False;
- Writeln(FilVar,'');
- ScreenLines := ScreenLines + 1;
- end;
- end
- else { Yes it is }
- begin
- if not MatchFound then
- begin
- if ((print) and (ScreenLines > 50)) { 50 on paper is ok }
- or ((not print) and (ScreenLines > 17)) then
- begin { 17 is about all you want }
- if print then { on the screen at a time }
- begin
- Writeln(FilVar,#$0C);
- end
- else
- begin
- Write(' More');
- Read(Kbd,Temp); { I'll wait until you read these }
- ClrScr; { Lets start anew }
- end;
- HeadingDupe; { Put the heading back }
- ScreenLines := 0; { I got nothing on the screen }
- end;
- Write(FilVar,OldAttr); { Write the old data }
- Write(FilVar,OldName,' ');
- If Print then Write(FilVar,OldFileSize,' '); { *2* Print Size if .LST *** }
- Str(OldDA,WrkMN); { *2* Fix DAY Also *** }
- FixMinute; { *2* }
- Write(FilVar,OldMO:2,'/',WrkMN,'/',OldYR); { *2* Changed OldDA to WrkMn ** }
- Str(OldMN,WrkMN); { Convert numeric to string }
- FixMinute; { now make it more readable }
- { *2* Following to get rid of 24 hour time *** }
- If OldHR >= 12 then ap := 'p' else ap := 'a';
- If OldHR > 12 then OldHR := OldHR -12;
- If OldHR = 0 then OldHR := 12;
- { *2* End time changes *** }
- Write(FilVar,' ', OldHR:2,':',WrkMN);
- Write(FilVar,ap); { *2* Add am/pm indicator *** }
- Write(FilVar,' '); { Continue printing }
- if length(InputString) > 0 then { Did I get a command line }
- begin { Is it the main directory } { Yes }
- if length(OldDir) > 3 then { Nope }
- Writeln(FilVar,OldDir)
- else { this is the main directory } { No }
- Writeln(FilVar,buffer,'\')
- end
- else
- if length(OldDir) > 1 then { Is it the main directory }
- Writeln(FilVar,OldDir) { Nope }
- else
- Writeln(FilVar,'\'); { this is the main directory }
- ScreenLines := ScreenLines + 1; { Its one more than it was }
- end;
- Write(FilVar,DirectryRec.FileAttributes); { Lets write the current }
- Write(FilVar,DirectryRec.FileNme,' '); { Record }
- Write(FilVar,DirectryRec.FileMO:2,'/',DirectryRec.FileDA:2,'/',DirectryRec.FileYR);
- Str(DirectryRec.FileMN, WrkMN);
- FixMinute;
- Write(FilVar,' ',DirectryRec.FileHR:2,':',WrkMN);
- Write(FilVar,' ');
- if length(InputString) > 0 then { Did I get a command line }
- begin
- if length(DirectryRec.FileDir) > 3 then { Main Directory }
- Writeln(FilVar,DirectryRec.FileDir) { Yes a cmd line }
- else
- Writeln(FilVar,buffer,'\') { this is the main directory }
- end
- else { I didn't get a command string }
- if length(DirectryRec.FileDir) > 1 then
- Writeln(FilVar,DirectryRec.FileDir)
- else
- Writeln(FilVar,'\'); { this is the main directory }
- ScreenLines := ScreenLines + 1;
- SetUpOldArea;
- MatchFound := True;
- end;
- end;
- until SortEOS; { Do it until its done }
- end;
-
- begin { Main program }
- ClrScr; { *2* For Turbo 3.0 (K.F.) *** }
- Write(Lst,#27,'Q',#27,'L020'); { *2* Sets Nec-8023 to 17 Ch, Left Margin 20 (K.F.) *** }
- InputString := CL; { get command line }
- if length(InputString) = 0 then { I didn't get one }
- Buffer := '' { so make the buffer blank }
- else
- begin { Yes I did get one }
- Buffer[1] := UpCase(InputString[2]); { only take the drive character }
- Buffer[2] := ':'; { put in our own : }
- Buffer[3] := Chr(0); { End the data }
- Buffer[0] := chr(2); { Make it length 2 }
- end;
- Time; { Get the time }
- Date; { Get the date }
- FirstTime := True; { First time here }
- MatchFound := False; { Haven't found any matches yet }
- GoToXY(10,5); { Fill the screen with data }
- Write('Directory List Program Version 1.0'); { This is it }
- GoToXY(10,7);
- Write('Written by');
- GoToXY(20,8);
- Write('Karson W. Morrison'); { This is who did it }
- GoToXY(20,9);
- Write('Feb. 13, 1985'); { And When }
- GoToXY(10,11);
- Write('OPTIONS:');
- GoToXY(11,12);
- Write('List the entire directory of the disk: (1)');
- GoToXY(11,13);
- Write('List only Duplicate files on the disk: (2)');
- GoToXY(22,20);
- Write('For output on printer enter (P) prior to number option');
- GoToXY(14,15);
- Write('Option: ');
- read(Kbd,Option);
- GoToXY(22,15);
- Writeln(Upcase(Option));
- if Upcase(Option) = 'P' then
- begin { Set up file for listing }
- Print := True;
- Assign(FilVar,'LST:');
- GoToXY(22,15);
- read(Kbd,Option);
- GoToXY(22,15);
- Writeln(Option);
- end
- else { Set up file for console }
- begin
- Print := False;
- Assign(FilVar,'CON:');
- end;
- Rewrite(FilVar);
- Writeln;
- ScreenLines := 0;
- PageNo := 0;
- Write('Reading the Directories');
- SortResult := TurboSort(SizeOf(DirectryRec)); { this does the call to the sort }
- if SortResult > 1 then { if the sort don't work }
- begin { This maybe what is wrong }
- if SortResult = 3 then Writeln('Not enouth memory for sorting');
- if SortResult = 9 then Writeln('More than 32767 records being sorted');
- if sortresult = 10 then Writeln('Disk error during sorting (bad or full)');
- if SortResult = 11 then Writeln('Read error during sort (Probably bad disk)');
- if sortResult = 12 then Writeln('File creation error (directory may be full)');
- end;
- Writeln;
- if print then
- begin
- Writeln(FilVar,' Number of Directories: ',E-1,' Number of Files: ',NumberRecs-E+1);
- Writeln(FilVar,#$0C);
- GoToXY(1,15); { this is for the Writeln below this }
- end;
- Writeln(' Number of Directories: ',E-1,' Number of Files: ',NumberRecs-E+1);
- end.