home *** CD-ROM | disk | FTP | other *** search
- Program ArcTree;
- {
- Author : E. J. Devin
- 10 Morningside Drive
- Dover, MA 02030
- on BCS BBS 332-5584 as Edward Devin
-
- Date : 7/18/88
- Comments : The Reason for this code was to play with the
- the built in disk functions in Turbo Pascal 4.0
- This code runs well enough to give you a good
- idea of how to use the fucntions
- Any extra code or declarations should be ignored
- as it is for a extended version of this program
-
- }
-
-
-
-
-
-
- uses dos,crt;
-
- Type
-
- Dir_point = ^dir_type;
- dir_type = Record
- entry_type : byte;
- attr : byte;
- time : longint;
- size : longint;
- name : string[12];
- next : dir_point;
- dir : dir_point;
- end;
- str256 = string[120];
- str12 = string[12];
-
-
- var
- Root,pt1,pt2,pt3 : Dir_point;
- Dir_info : SearchRec;
- x,dirs : integer;
- filesize,filed : longint;
- s : char;
- one : boolean;
-
- Procedure get_it(path: str256; files:str12; extra:str256; rt:boolean);
-
- var
- finfo:searchrec;
- firsttwo:integer;
- fdate:datetime;
- ffiles:str12;
-
- Begin
- firsttwo:=1;
- if files <> '*.*' then
- begin
- ffiles:=files;
- files:='*.*';
- end;
- findfirst(path+files,anyfile,finfo);
- while doserror = 0 do
- begin
- firsttwo:=firsttwo+1;
- if x > 22 then
- begin
- write('hit key to continue');
- readln;
- x:=0;
- clrscr;
- end;
- if ((firsttwo > 3) or rt) then
- begin
- x:=x+1;
- unpacktime(finfo.time,fdate);
- if ((finfo.size = 0) and one) then
- begin
- one:=false;
- write('\');
- end
- else write(extra+finfo.name,' ');
- if ((finfo.size = 0) and (not one)) then
- write(' <DIR>');
- if (finfo.size > 0) then
- write(fdate.month,'/'
- ,fdate.day,'/'
- ,fdate.year,' '
- ,fdate.hour,':'
- ,fdate.min,':'
- ,fdate.sec,' '
- ,finfo.size,' bytes');
- writeln;
- end;
- if (((finfo.attr = 16) and (firsttwo > 3)) or rt) then
- begin
- get_it(path+finfo.name+chr(92),files,extra+chr(179)+' ',false);
- dirs:=dirs+1;
- end;
- filesize:=filesize+finfo.size;
- filed:=filed+1;
- findnext(finfo);
- end;
- end;
- Procedure rget_it(path:str256;files:str12; extra:str256);
-
- var
- finfo:searchrec;
- firsttwo:integer;
-
- Begin
- firsttwo:=1;
- findfirst(path+files,anyfile,finfo);
- while doserror = 0 do
- begin
- new(pt1);
- firsttwo:=firsttwo+1;
- x:=x+1;
- if ((finfo.attr = 16) and
- (firsttwo > 3)) then
- begin
- get_it(path+finfo.name+chr(92),files,extra+chr(179)+' ',false);
- dirs:=dirs+1;
- end;
- findnext(finfo);
-
- end;
- end;
-
- Begin
-
- x:=0;
- filesize:=0;
- filed:=0;
- dirs:=0;
- root:=nil;
- pt3:=root;
- textmode(co80);
- directvideo:=true;
- one:=true;
- clrscr;
- get_it(chr(92),'*.*',chr(179)+' ',true);
- writeln('strike key to continue');
- repeat
- until keypressed;
- s:=readkey;
- clrscr;
- filed:=filed-((dirs-1)*3);
- writeln('the total number of directories was :',dirs);
- writeln('the total number of files was :',filed);
- writeln(' the average file size is :',(round(filesize/filed)):20);
- writeln('the total number of bytes in files is :',filesize);
- writeln('the total free space on the disk is :',diskfree(0));
- writeln('the total size of the disk is :',disksize(0));
- writeln('the percentage of the disk used is :',
- (((disksize(0)-diskfree(0))
- /disksize(0))
- *100):10:2,' %');
- end.