8-Bit Software Online Conversion
Tree Rename Utility v2 - Listing
10*|"
20*|" Tree Rename V.2
30*|"
40*|" Written by Alex Savvides
50*|" For 8-Bit Public Domain
60*|"
70*|" A program to rename one
80*|" or all directories to a
90*|" new directory
100*|"
110*|" Updated : 2/9/91
120*|"
130*|"
|
140:
150IFPAGE<>&1900THENPRINT'" Set PAGE t
o &1900 and re-load":END
160:
170*TV 255
180MODE7
190IFINKEY(-256)=253THENPRINT'" There
is no guarantee that Tree Rename"'" work
s on a BBC Master - Good Luck":GGG=INKEY
(200):CLS
200DIMfile$(34),mark$(34)
210DIMp%256
220:
230PROCinit
240PROCoff
250PROCtitle
270ONERRORIFERR<>17PROCerror
271REPEAT
280PROCread`files
290IFB%=0THENPROCno`files:GOTO270ELSEP
ROCnot`available
300PROCwork`screen
310IFH=68THENPROCclear`tags:GOTO270
320UNTILH=81
330CALL!-4
340END
350:
360DEFPROCread`files
370CLS
380PROCoff
390PRINTtag$"Reading files ... Please
wait";
400PROCclr`mem
410*FX3 2
420*DIR$
430*.
440*.
450*FX3
460A%=&0E08
470B%=1
480REPEAT
490IF?(A%+7)=0THENR$="$."ELSER$=CHR$(?
(A%+7))+"."
500file$(B%)=R$
510D%=0
520REPEAT
530IF?(A%+D%)>0OR?(A%+D%)<>&FFTHENfile
$(B%)=file$(B%)+CHR$((?(A%+D%))AND127)
540D%=D%+1
550UNTILD%=7OR?(A%+D%)=32
560file$(B%)=FNupcase(file$(B%))
570:
580IFMID$(file$(B%),3,1)<>CHR$0ANDLEN(
file$(B%))>=3THENB%=B%+1:PRINTTAB(31,0);
B%-1
590A%=A%+8
600UNTIL?A%=0ORA%=&F00ORB%=32
610B%=B%-1
620ENDPROC
630:
640DEFPROCrename`files
650done=0
660IFS$=D$PROCmessage("Source & rename
are the same!",1):ENDPROC
670LOCALz
680IFFNcount`tagged=FNtaggedTHENPROCme
ssage("All files already exist",1):S$=""
:D$="":PROCuntag`files:z=1:ENDPROC
690IFFNare`you`sure=FALSETHENENDPROC
700PROCmessage("Please wait...",0)
710FORn=1TOB%
720HH=0
730GG=FALSE
740REPEAT:HH=HH+1
750IFmark$(HH)=tag$THENGG=TRUE
760UNTILGG=TRUEORHH=B%
770IFGG=TRUETHENGOTO790
780IFHH=B%THENGOTO950
790a$=file$(HH)
800JJJJ=INKEY(0)
810IFJJJJ=9THENPROCmessage("Rename ter
minated",1):n=B%:GOTO950
820IFa$=""THENGOTO950
830z=LEN(a$)-2
840b$=MID$(a$,3,z)
850IFS$<>""ANDD$<>""THENIFLEFT$(a$,1)<
>S$GOTO950
860IFS$=""ANDD$<>""ANDLEFT$(a$,1)=D$TH
ENGOTO730
870IFFNms(a$)=TRUETHENGOTO720
880PROCtreb(a$)
890OSCLI"RENAME "+a$+" "+D$+"."+b$
900file$(HH)=D$+MID$(file$(HH),2,LEN(f
ile$(HH)))
910PROCsearch
920PRINTTAB(ex,wi);" ";ren$;D$
930mark$(HH)=ren$
940done=done+1
950NEXTn
960PROCmessage(STR$(done)+" files rena
med",1)
970S$="":D$=""
980PROCupdate`values
990ENDPROC
1000:
1010DEFPROCerror
1020*FX3
1030VDU7,12
1040IFERR=17THENENDPROC
1050PRINTno$"An error has occured:"
1060REPORT:PRINT" at line ";ERL
1070PROCkey
1080PROCset`drive(0)
1090ENDPROC
1100:
1110DEFPROCinput(text$,forbid$)
1120REPEAT
1130G$=GET$
1140UNTILINSTR(forbid$,G$)=0
1150IFG$=CHR$(13)THENG$=""
1160ENDPROC
1170:
1180DEFPROCtitle
1190FORK=0TO1
1200PRINTTAB(0,K);" ";CHR$157;CHR$141"
Tree Rename Version 2"
1210NEXT
1220PRINTSPC(7);ren$;"Written by Alex S
avvides"
1230PRINTTAB(0,24);" ";CHR$157;" An
8-Bit Public Domain Utility";
1240VDU28,0,23,39,4
1250ENDPROC
1260:
1270DEFPROCinit
1280tag$=CHR$131
1290untag$=CHR$135
1300ren$=CHR$134
1310no$=CHR$129
1320PROCclear`tags
1330*FX4 2
1340PROCset`drive(0)
1350S$="":D$=""
1360*FX11
1370CLOSE#0
1380PROCclr`mem
1390ENDPROC
1400:
1410DEFPROCoff:VDU23;8202;0;0;0;:ENDPRO
C
1420:
1430DEFPROCmark`file
1440IFLEFT$(file$(z),1)=D$THENVDU7:ENDP
ROC
1450IFmark$(z)=untag$THENmark$(z)=tag$:
ENDPROC
1460IFmark$(z)=tag$THENmark$(z)=untag$
1470ENDPROC
1480:
1490DEFPROCwork`screen
1500S$="":D$=""
1510VDU26:PROCtitle
1520VDU12,26
1530PRINTTAB(3,4);" WHITE:untagged YEL
LOW:tagged"
1540PRINTTAB(3,5);" CYAN:renamed RED
:not available"
1550PRINTTAB(2,21);" (T)ag all (U)ntag
all (D)rive"
1560PRINTTAB(2,22);" (S)ource (R)enam
e (G)o!"
1570PRINTTAB(2,23);" (C)lear (Q)uit
(*) command"
1580PROCdisplay`files
1590z=1
1600REPEAT
1610PROCoff
1620PROCupdate`values
1630bar$=CHR$132+CHR$157
1640PRINTTAB(x,y);bar$;mark$(z);
1650xx=x:yy=y
1660*FX4 1
1670PROCmessage("Select files or key a
command:",0)
1680H=GET
1690IFH=42THENPROCos`command
1700IFH=83THENPROCinput`source
1710IFH=68THENPROCselect`drive
1720IFH=67THENPROCclear`CYAN`tags:PROCd
isplay`files
1730IFH=71THENPROCcheck`vars:PROCuntag`
files:PROCdisplay`files
1740IFH=82THENPROCselect`rename
1750IFH=84THENPROCtag`all:PROCdisplay`f
iles
1760IFH=85THENPROCuntag`files:PROCdispl
ay`files
1770IFH=136ANDx<>0THENx=x-13:PROCcursor
`pos:GOTO1850
1780IFH=136ANDx=0ANDy<>0THENx=26:y=y-1:
PROCcursor`pos
1790IFH=137ANDz=B%THENGOTO1830
1800IFH=137ANDx=26THENy=y+1:x=0:PROCcur
sor`pos:GOTO1830
1810IFH=137THENx=x+13:PROCcursor`pos
1820IFH=138ANDfile$(z+3)<>""ANDy<>MAXTH
ENy=y+1:PROCcursor`pos
1830IFH=139ANDy<>0THENy=y-1:PROCcursor`
pos
1840IFH=13PROCmark`file:PROCcursor`pos
1850:
1860PRINTTAB(xx,yy);" ";CHR$156;
1870UNTILH=68ORH=81ORH=42
1880IFH=42THENGOTO1580
1890ENDPROC
1900:
1910DEFPROCcursor`pos
1920IFH=136THENz=z-1
1930IFH=137THENz=z+1
1940IFH=139THENz=z-3
1950IFH=138THENz=z+3
1960ENDPROC
1970:
1980DEFFNare`you`sure
1990PROCmessage("Confirm - Rename tagge
d files?",0)
2000REPEAT
2010YES$=GET$
2020UNTILINSTR("YyNn",YES$)
2030IFINSTR("Nn",YES$)THEN=0
2040=-1
2050DEFPROCkey:VDU26:PRINTTAB(3,24);"
Press any key to continue ";:AA=GET
:PRINTTAB(0,24);" ";CHR$157;" An 8-Bi
t Public Domain Utility";:VDU28,0,19,39,
7,12,28,0,19,39,7,12:ENDPROC
2060:
2070:
2080DEFPROCtag`all
2090FORGG=1TOB%
2100IFLEFT$(file$(GG),1)<>D$ANDmark$(GG
)<>ren$ANDmark$(GG)<>no$THENmark$(GG)=ta
g$
2110NEXT
2120PROCupdate`values:ENDPROC
2130:
2140DEFPROCuntag`files
2150FORGG=1TOB%
2160IFmark$(GG)<>ren$ANDmark$(GG)<>no$T
HENmark$(GG)=untag$
2170NEXT:ENDPROC
2180:
2190DEFPROCselect`rename
2200VDU23;82090;0;0;0;
2210PRINTTAB(21,12);
2220PROCinput("",""":. "):D$=G$
2230PROCoff
2240ENDPROC
2250:
2260DEFPROCinput`source
2270VDU23;82090;0;0;0;
2280PRINTTAB(11,12);
2290PROCinput("",""":. "):S$=G$
2300PROCoff
2310PROCuntag`files
2320PROCtagit:PROCdisplay`files
2330ENDPROC
2340:
2350DEFPROCupdate`values
2360VDU26,28,0,20,39,7
2370PRINTTAB(2,11);" DRIVE: ";dr$;" FI
LES: ";B%;" IN USE: ";FNtagged;" ";
2371PRINTTAB(11,12);" ";TAB(21,12);" "
2380PRINTTAB(2,12);" SOURCE: ";S$;
2390PRINTTAB(12,12);" RENAME: ";D$;
2400ENDPROC
2410:
2420DEFFNtagged:tag=0
2430LOCALG
2440FORG=1TOB%
2450IFmark$(G)=tag$THENtag=tag+1
2460NEXT
2470=tag
2480:
2490DEFPROCselect`drive
2500VDU23;82090;0;0;0;
2510PRINTTAB(10,11);
2520REPEAT:dr$=GET$:UNTILINSTR("0123",d
r$):OSCLI"dri. "+dr$:PRINTdr$:ENDPROC
2530:
2540:
2550DEFPROCcheck`vars
2560IFLEN(S$)=1ANDLEN(D$)=1THENGOTO2610
2570IFLEN(S$)=1ORLEN(D$)=1ANDFNtagged=0
THENPROCmessage("No files selected",1):E
NDPROC
2580IFS$=""ANDD$<>""ANDFNtagged<>0THENP
ROCms:GOTO2610
2590IFS$=""ANDD$=""THENPROCmessage("Sou
rce/Rename directories?",1):ENDPROC
2600IFFNtagged>0ANDD$=""THENPROCmessage
("Rename directory?",1):ENDPROC
2610PROCrename`files:ENDPROC
2620:
2630DEFPROCmessage(TEXT$,KEY)
2640PRINTTAB(3,13);STRING$(36," ");
2650PRINTTAB(0,13);" ";CHR$157tag$;TEX
T$;" ";CHR$156;
2660VDU7
2670IFKEY=0THENENDPROC
2680A=INKEY(200)
2690PRINTTAB(0,13);STRING$(37," ");:END
PROC
2700:
2710DEFPROCclear`CYAN`tags
2720LOCALH
2730FORH=1TOB%
2740IFmark$(H)=ren$THENmark$(H)=untag$
2750NEXTH
2760ENDPROC
2770:
2780DEFPROCtagit
2790GH=0
2800FORVG=1TOB%
2810IFLEFT$(file$(VG),1)=S$ANDmark$(VG)
<>ren$ANDmark$(VG)<>no$THENmark$(VG)=tag
$:GH=GH+1
2820NEXT
2830IFGH=0THENPROCmessage("No files fou
nd in '"+S$+"' directory",1):S$="":ENDPR
OC
2840ENDPROC
2850:
2860DEFFNms(check$)
2870LOCALF:LOCALT
2880F=FALSE
2890T=0:REPEAT
2900T=T+1
2910IFfile$(T)=D$+MID$(check$,2,LEN(che
ck$))THENPROCmessage(D$+MID$(check$,2,LE
N(check$))+" exists!",1):mark$(HH)=untag
$:F=TRUE:PROCmessage("Please wait...",0)
2920UNTILT=B%ORF=TRUE
2930IFF=TRUETHEN=TRUE
2940=FALSE
2950:
2960DEFPROCtreb(check$)
2970LOCALG
2980FORG=1TOB%
2990IFMID$(check$,3,LEN(check$))=MID$(f
ile$(G),3,LEN(file$(G)))ANDG<>HHTHENmark
$(G)=no$
3000NEXTG
3010ENDPROC
3020:
3030DEFPROCnot`available
3040FORa=1TOB%
3050FORb=aTOB%
3060:
3070IFMID$(file$(a),3,LEN(file$(a)))=MI
D$(file$(b),3,LEN(file$(b)))ANDfile$(a)<
>file$(b)THENmark$(b)=no$
3080NEXTb
3090NEXTa
3100ENDPROC
3110:
3120DEFPROCms
3130FORTT=1TOB%
3140IFmark$(TT)<>tag$THENGOTO3160
3150IFLEFT$(file$(TT),1)=S$mark$(TT)="
"
3160NEXT:ENDPROC
3170:
3180DEFPROCset`drive(drive)
3190IFdrive>0ANDdrive<4THENdr$=STR$(dri
ve)
3200dr$=STR$(drive)
3210OSCLI"DRI. "+dr$:ENDPROC
3220:
3230DEFPROCdisplay`files
3240C=0
3250VDU28,0,17,39,7,12
3260FORY=1TOB%
3270PRINT;" ";mark$(Y);file$(Y);SPC(12
-LEN(file$(Y)+" "));CHR$156;:C=C+1
3280IFC=3THENPRINT';:C=0
3290NEXTY
3300:
3310x=0:y=0:z=1
3320MAX=INT(B%/3)
3330ENDPROC
3340:
3350DEFPROCsearch
3360ex=-13:wi=0
3370FORR=1TOHH
3380ex=ex+13
3390IFex=39THENwi=wi+1:ex=0
3400NEXT
3410ENDPROC
3420:
3430DEFFNupcase($p%)
3440LOCALA%,B%,L%,Z%
3450A%=ASC"a":Z%=ASC"z"
3460FORL%=0TOLEN($p%)-1:B%=p%?L%
3470IFB%>=A%IFB%<=Z%p%?L%=B%AND&5F
3480NEXT:=$p%
3490:
3500DEFFNcount`tagged
3510yes=0
3520FORT=1TOB%
3530IFmark$(T)<>tag$THENGOTO3550
3540IFLEFT$(file$(T),1)=D$THENyes=yes+1
3550NEXT
3560=yes
3570:
3580DEFPROCno`files
3590CLS
3600ONERRORCALL!-4
3610PRINTren$"There are no renameable f
iles"
3620PRINTren$"on this disk."'
3630PRINTtag$"Please insert another dis
k, or enter"
3640PRINTtag$"an alternative drive no.:
"
3650PRINT'" Enter new drive (ESCAPE TO
QUIT) : "
3660REPEAT
3670DR$=GET$
3680UNTILINSTR("0123",DR$)
3690OSCLI"DRI. "+DR$
3700ENDPROC
3710:
3720DEFPROCclear`tags
3730FORT=1TO31:mark$(T)=" ":NEXTT
3740ENDPROC
3750:
3760DEFPROCos`command
3770CLS
3780INPUT" Enter command: *"OS$
3790CLS
3800OSCLIOS$
3810PROCkey
3820ENDPROC
3830DEFPROCclr`mem
3840FORI=&0E08TO&F00
3850?I=0
3860NEXT:ENDPROC