10 ' *DISKPGM2.BAS     PROGRAM TO SORT ALL FILES ON A DISK AND CREATE A FILE
20 ' CALLED COPYHHMM.BAT FOR EXECUTION AND COPY IN ALPHABETICAL SEQUENCE
30 CLS
40 PRINT "(C) Copyright 1982,, Richard Schinnell,Rockville, MD. 20853 (301) 949-8848
50 PRINT:LOCATE 10,1,1
60 COLOR 7,0:PRINT" WHICH DISK DRIVE DO YOU WANT TO CHECK> A OR B :":COLOR 7,0
70 RICH$=INKEY$:IF LEN(RICH$)<>1 THEN 70
80 IF LEFT$(RICH$,1)="A" OR LEFT$(RICH$,1) ="B" THEN DRIV$=LEFT$(RICH$,1)+":" ELSE 60
90 ON ERROR GOTO 630
100 KEY OFF
110 FALSE=0:TRUE=NOT FALSE:DEFINT A-Z:L=0:CLS:CODE=43:DIM F$(75)
120 DIM F1$(75)
130 X=0:O=1
140 FILES DRIV$+"*.*"
150 CLINE1 = CSRLIN
160 D=0
170 LOCATE 1,1,1
180 FOR I = 1 TO CLINE1
190 FOR B = 1 TO 66 STEP 13
200 D=D+1
210 FOR N = 0 TO 11
220 T = SCREEN(I,(B+N)):F$(D)=F$(D)+CHR$(T)
230 NEXT N
240 IF LEFT$(F$(D),1)=" " THEN D=D-1 :GOTO 270
250 NEXT B
260 NEXT I
270 G$= DRIV$+"COPY"+MID$(TIME$,1,2)+MID$(TIME$,4,2)+".BAT"
280 LOCATE 15,1:COLOR 26,0:PRINT "ALPHABETIZING THE FILE NAMES ":COLOR 7,0
290 ' THIS ALPHABETIZES THE ARRAY
300 FOR X=1 TO D-1:FOR Y=X+1 TO D:IF F$(Y)32 THEN U$=U$+L$
360 NEXT E
370 F$(I)=U$
380 U$=""
390 NEXT I
400 CLS:LOCATE 12,25:COLOR 28,0:PRINT " WRITING FILE  ";G$:COLOR 7,0
410 OPEN  G$ FOR APPEND AS #1
420 PRINT #1,"REM  THIS PGM WILL AUTOMATICALLY COPY A TO B SORTED
430 PRINT #1, "PAUSE
440 FOR I = 1 TO D
450 PRINT #1,"COPY ";F$(I);" B:"
460 NEXT I
470 CLOSE #1
480 CLS:X=1:O=1
490 OPEN G$ FOR INPUT AS #1
500 FOR I = 1 TO D
510 IF I > 23 THEN X = I-23:O=30
520 IF I > 46 THEN X = I-46:O=60
530 X = X +1
540 LOCATE X,O,1
550 LINE INPUT #1,F$(I)
560 PRINT F$(I);
570 NEXT I
580 CLOSE #1
590 LOCATE 25,1,1:COLOR 28,0:PRINT" HIT ANY KEY TO CLEAR SCREEN AND CONTINUE":COLOR 7,0
600 RICHA$=INKEY$:IF RICHA$="" THEN 600
610 CLS
620 END
630 PRINT "ERROR ";ERR;" HAS OCCURED IN LINE # ";ERL
640 END