0010 REM "Program conversion system
0020 REM "Developed by Sybex ltd. -- Mike King
0030 PRINT 'CS',"OPEN BASIC Program Conversion Utility",'LF',"Written By Sybex 
0030:Ltd.",
0040 DIM D$[20]
0050 OPEN (1)"."; LET D$=FID(1); CLOSE (1)
0060 LET D$=D$(35),D$=D$(1,POS($00$=D$)-1)
0070 PRINT @(0,4),'CE','CYAN',"Input directory ("+D$+"):",; INPUT D1$
0080 IF CTL<>0 THEN STOP
0090 IF D1$<>"" THEN OPEN (1,ERR=0070)D1$; LET A$=FID(1); CLOSE (1); IF A$(10,1
0090:)<>$17$ THEN GOTO 0070 ELSE LET D$=D1$
0100 INPUT @(0,5),'CE','CYAN',"Output Text File name:",'WHITE',O$
0110 IF O$="" OR CTL<>0 THEN GOTO 0070
0120 OPEN (2,ERR=0150)O$; CLOSE (2)
0130 INPUT 'RED',@(0,6),"File exists Overwrite (N/y):",'WHITE',YORN$
0131 LET YORN$=CVS(YORN$,4); REM Convert to upper
0140 IF CTL<>0 OR POS("Y"=YORN$)<>1 THEN GOTO 0100
0141 ERASE O$
0150 STRING O$
0170 OPEN (2)O$
0180 LET D=3
0190 OPEN (D)D$
0191 LET D_LEN=LEN(D$)+2
0200 REM ^100 "Get work file
0210 LET WRK_CNT=0
0220 LET WRK_FL$="WORK."+STR(WRK_CNT:"000")
0230 CLOSE (1); OPEN (1,ERR=0240)WRK_FL$; LET WRK_CNT=WRK_CNT+1; GOTO 0220
0240 REM
0300 REM ^100 "Do all programs
0310 NEXT_FILE: 
0320 READ RECORD (D,END=END_DIR)F$
0330 IF F$(1,1)="." THEN GOTO 0320
0340 OPEN (D+1)D$+"/"+F$
0350 LET X$=FID(D+1)
0360 IF X$(10,1)=$17$ THEN GOTO NEW_DIR
0370 IF X$(10,1)<>$04$ THEN CLOSE (D+1); GOTO 0310
0380 CLOSE (D+1)
0390 LET P$=D$+"/"+F$
0400 PRINT @(0,22),'CL',@(0,10),'LI',P$,
0420 ERASE WRK_FL$,ERR=0421
0440 LIST PROGRAM P$,WRK_FL$
0450 OPEN (1)WRK_FL$
0460 PRINT (2)"PROG: ",P$(D_LEN)
0470 READ RECORD (1,END=0500)R$
0471 IF R$(LEN(R$),1)=$0A$ THEN LET R$=R$(1,LEN(R$)-1)
0480 PRINT (2)R$
0490 GOTO 0470
0500 CLOSE (1)
0510 GOTO NEXT_FILE
0520 NEW_DIR: 
0530 LET D$[D]=D$
0540 LET D$=D$+"/"+F$
0550 LET D=D+1; GOTO NEXT_FILE
0560 END_DIR: 
0565 CLOSE (D)
0570 LET D=D-1
0580 LET D$=D$[D]
0590 IF D$<>"" THEN GOTO NEXT_FILE
0600 REM 
0610 PRINT 'CS',"OPEN BASIC Program Conversion Utility",'LF',"Written By Sybex 
0610:Ltd.",
0620 PRINT @(0,10),"The Bundle file has been created.  Please Exit Open Basic."
0630 PRINT @(0,12),"To proceed, start ProvideX and Run the utility:" 
0640 PRINT @(0,14),"                  /pvx/lib/_conv.ob/unbundle.ob"
0650 PRINT @(0,20),
0700 END
