8-Bit Software Online Conversion
Econet Tree - Listing
10REM >ETree
20REM Displays directory tree
30REM (C) J.G.Harston
40REM
50DIM ch$(10),buff% 20,data% 100:tota
l%=0:up%=(FN`INFO("^")=2)
60REPEAT:INPUT"Path to show: "path$
70IF NOT up% AND INSTR(path$,"$")=0 P
RINT"Needs a reference to root ($)":path
$=""
80IF path$<>"" THEN IF FN`INFO(path$)
<>2 PRINTpath$;" is not a directory":pat
h$=""
90UNTILpath$<>""
100INPUT"List files? "F$:F$=LEFT$(F$,1
):Fflg%=F$="Y" OR F$="y"
110INPUT"Printout? "P$:P$=LEFT$(P$,1):
Pflg%=P$="Y" OR P$="y"
120ibm%=Pflg%:PROCch:IFPflg% VDU2
130OSCLI"DIR "+path$:PROCgbpb(5,0):?(d
ata%+1+?data%)=13:PRINT"Disk: ";$(data%+
1)
140PROCgbpb(6,0):?(data%+?data%+?(data
%+1+?data%)+2)=13:PRINT"Dir: "$(data%+2+
?data%);
150total%=FNcat(0,0,0):PROCup(MID$(pat
h$,INSTR(path$,".")+1))
160PRINT'"Total disk space used: ";tot
al%;" bytes"
170IF Pflg% AND Fflg% CLS
180IF Pflg% VDU 3
190END
200:
210DEFPROCgbpb(A%,index%):LOCAL X%,Y%
220buff%!1=data%:buff%!5=1:buff%!9=ind
ex%
230X%=buff%:Y%=X%DIV256:CALL &FFD1:END
PROC
240:
250DEFFNcat(lv%,flg%,flg2%):LOCAL end%
,total%,index%:index%=flg2%:total%=0:xt%
=0
260REPEAT:PROCgbpb(8,index%):index%=bu
ff%!9:end%=buff%?5
270IFend%=0 AND flg2%<>0 AND Fflg% THE
N UNTIL TRUE:=TRUE
280IFend%=0 PROCfile
290UNTIL end%<>0 OR xt%:IF flg2%<>0 :=
xt%
300=total%
310:
320DEFPROCfile:LOCAL f$,type%:xt%=FALS
E
330?(data%+?data%+1)=13:f$=FNstrip($(d
ata%+1)):type%=FN`INFO(f$)
340total%=total%+buff%!10:IF buff%?10<
>0 THEN total%=(total% AND &FFFF00)+&100
350IF flg2%<>0 AND type%=2 THEN xt%=TR
UE:ENDPROC
360IF Fflg% OR type%=2 PROCpr(f$)
370IF type%=2 THEN PROCdown(f$):total%
=total%+FNcat(lv%+1,LENf$,0):PROCup(f$)
380ENDPROC
390:
400DEFPROCpr(f$)
410nxt%=FNcat(lv%,0,index%)
420IFflg%<>0 PRINTSTRING$(11-flg%,CHR$
c%(0));
430IFnxt% ch$(lv%)=CHR$c%(3) ELSE ch$(
lv%)=" "
440IFflg%<>0 AND nxt% VDUc%(1):flg%=0:
GOTO480 ELSE IFflg%<>0 AND nxt%=0 VDUc%(
0):flg%=0:GOTO480
450PRINT
460IFlv%>0 FORz=0TOlv%-1:PRINTch$(z);S
PC11;:NEXT
470IF nxt% VDUc%(5) ELSE VDUc%(4)
480PRINTf$;
490ENDPROC
500:
510DEFPROCdown(f$):path$=path$+"."+f$:
OSCLI"DIR "+f$:ENDPROC
520:
530DEFPROCup(f$):path$=LEFT$(path$,LEN
path$-LEN f$-1):IF up% OSCLI"DIR ^":END
PROC
540OSCLI"DIR "+path$:ENDPROC
550:
560DEFFN`INFO(f$):LOCAL A%,X%,Y%:$data
%=f$:!buff%=data%:X%=buff%:Y%=X%DIV256:A
%=5:=(USR&FFDD)AND&FF
570DEFFNstrip(f$):IF LEFT$(f$,1)=" " R
EPEAT:f$=MID$(f$,2):UNTILLEFT$(f$,1)<>"
"
580f$=LEFT$(f$,INSTR(f$+" "," ")-1):=f
$
590:
600DEFPROCch
610DIM c%(5):FORz%=0 TO 5:c%(z%)=z%+16
6:NEXT
620IFibm% c%(0)=&C4:c%(1)=&C2:c%(2)=25
4:c%(3)=&B3:c%(4)=&C0:c%(5)=&C3
630VDU23,c%(0),0,0,0,255,0,0,0,0
:REM ---
640VDU23,c%(1),0,0,0,255,24,24,24,24
:REM -v-
650REM c%(2)
660VDU23,c%(3),24,24,24,24,24,24,24,24
:REM |
670VDU23,c%(4),24,24,24,24+7,0,0,0,0
:REM ½
680VDU23,c%(5),24,24,24,24+7,24,24,24,
24:REM +-
690ENDPROC