* utility to scan down directories and create an index.html that has references
* to the files in the directories
* Kevin Atkins, May 1, 2002

CLOSE ALL
CLEAR ALL
RELEASE ALL

*rootdir = "t:\webhost\20020430arly"
rootdir = "t:\webhost\animafortis"
CD (rootdir)
dircount = ADIR(webdirs, "*.*", "D")

thishtml = ""
DO webheader

FOR i = 1 TO dircount
	thisdir = ALLTRIM(PROPER(webdirs[i,1]))
	IF NOT "." $ thisdir
		CD (rootdir + "\" + thisdir)
		subdircount = ADIR(websubdir, "*.*", "ASHR")
		DO websubdir
	ENDIF
ENDFOR

DO webfooter
CD (rootdir)
=STRTOFILE(thishtml, "index.html")
CD (rootdir)
RETURN


PROCEDURE webheader
TEXT TO thishtml TEXTMERGE NOSHOW
<HTML>
<HEAD>
<TITLE>
MP3 files of Anima Fortis, BLEMF 2001 performance
</TITLE>
</HEAD>
<BODY>
<CENTER>
<H2>MP3 files of Anima Fortis, BLEMF 2001 performance</H2>
<P>

<TABLE WIDTH= "85%">
ENDTEXT
RETURN

PROCEDURE websubdir
TEXT TO thishtml TEXTMERGE NOSHOW  ADDITIVE
<TR>
<TD COLSPAN="2">
<H3>
<<thisdir>>
</H3>
</TD>
</TR>
ENDTEXT

FOR j = 1 TO subdircount
TEXT TO thishtml TEXTMERGE NOSHOW ADDITIVE
<TR>
<TD>
<A HREF="
<<thisdir + "/" + ALLTRIM(PROPER(websubdir[j,1]))>>
">
<<ALLTRIM(PROPER(websubdir[j,1]))>>
</A>
</TD>
<TD>
<<PADL(ALLTRIM(STR((websubdir[j,2]/1024)/1024)),20," ") + " MB">>
</TD>
</TR>

ENDTEXT
ENDFOR
TEXT TO thishtml TEXTMERGE NOSHOW ADDITIVE
<TR>
<TD colspan = "2">
<P>
<HR>
<P>
</TD>
</TR>
ENDTEXT
RETURN

PROCEDURE webfooter
TEXT TO thishtml TEXTMERGE NOSHOW ADDITIVE
</TABLE>
</CENTER>
</BODY>
<HTML>
ENDTEXT
RETURN
