💾 Archived View for mirrors.apple2.org.za › archive › ground.icaen.uiowa.edu › MiscInfo › Programmin… captured on 2023-01-29 at 10:16:10.

View Raw

More Information

-=-=-=-=-=-=-


 10 GOTO 1000
 20 REM STRIP TRAILING SPACES
 30 IF RIGHT$(T$,1) = " " THEN T$=LEFT$(T$,LEN(T$)-1): GOTO 30
 40 RETURN

200 REM OPEN THE DIRECTORY AS A FILE FOR READING
210 PRINT D$;"OPEN";PF$;",TDIR"
220 PRINT D$;"READ";PF$

230 REM READ A DIRECTORY INTO A$()
240 A=3:  A$(0)=PF$  : REM FULL PATH NAME
250 INPUT A$(1): REM CURRENT DIRECTORY NAME
260 INPUT A$(2): REM COLUMN TITLES
270 INPUT A$(3): REM BLANK LINE

280 A=A+1: INPUT A$(A): REM DIRECTORY ENTRY
290 IF A$(A)<>"" THEN GOTO 280
300 A=A+1: INPUT A$(A): REM FOOTER SUMMARY

310 REM CLOSE THE DIRECTORY FILE
320 PRINT D$;"CLOSE";PF$

330 REM TEST DATA (REMOVE FROM DEBUGGED PROGRAM)
340 IF A$(3)<>""   THEN PRINT "ERROR: HEADER BLANK LINE": STOP
350 IF A$(A-1)<>"" THEN PRINT "ERROR: FOOTER BLANK LINE": STOP
360 IF LEFT$(A$(A),5)<>"BLOCK" THEN PRINT "ERROR: FOOTER SUMMARY": STOP

370 REM SCAN THE DIRECTORY FOR SUB-DIRECTORIES AND ADD TO LIST
380 FOR I=4 TO A-2
390 : IF MID$(A$(I),18,3)="DIR" THEN T$=MID$(A$(I),2,15): GOSUB 20: P=P+1:
P$(P)=PF$+"/"+T$
400 NEXT I

410 REM WRITE THE DIRECTORY TO THE OUTPUT FILE AND CLEAR MOST OF A$()
420 PRINT D$;"APPEND";O$
430 PRINT A$(0): PRINT
440 FOR I=4 TO A-2
450 : PRINT A$(I): A$(I)=""
460 NEXT I
470 PRINT L1$
480 PRINT D$;"CLOSE";O$
490 PRINT D$;"FRE"

500 REM GET THE NEXT PREFIX
510 CP=CP+1: IF CP<=P THEN PF$=P$(CP): GOTO 200

520 REM FINISH
530 PRINT D$;"APPEND";O$
540 PRINT A$(A): REM LAST FOOTER SUMMARY
550 PRINT D$;"CLOSE";O$
560 END

1000 REM INITIALIZE
1010 TEXT: HOME: CLEAR: RESTORE
1020 D$=CHR$(4): MA=500: MP=100
1030 DIM A$(MA):
1040 DIM P$(MP): P=0: CP=0
1050
L1$="-----------------------------------------------------------------------
--------"
1060 L2$=" NAME           TYPE  BLOCKS  MODIFIED         CREATED
ENDFILE SUBTYPE"

1070 GOSUB 2000

1080 PRINT D$;"PREFIX,S";SL;",D";DR
1090 PRINT D$;"PREFIX": INPUT T$
1100 PF$=LEFT$(T$,LEN(T$)-1): REM REMOVE TRAILING SLASH
1110 P$(P)=PF$

1130 PRINT D$;"OPEN";O$
1140 PRINT D$;"WRITE";O$
1150 PRINT L2$: PRINT L1$
1160 PRINT D$;"CLOSE";O$

1170 GOTO 200

2000 REM GET SOURCE LOCATION AND DESTINATION FILE
2010 INPUT "SLOT   ";SL
2020 INPUT "DRIVE  ";DR
2030 INPUT "OUTPUT ";O$
2900 RETURN


--
Paul R. Santa-Maria
Monroe, Michigan USA