import os, os.path,string,cStringIO
from os.path import isdir, isfile, join
html_doc="""
index.html
EPICS Seminar in IHEP/Beijing
Aug.22 - Aug.31, 2001
IHEP, Beijing, China
Agenda
Aug. 22- 28 : EPICS seminar/Training
Aug. 29- 31 : Reports and Discussions
List of Participants
Documents used in the presentation/training
%s
"""
strout=cStringIO.StringIO()
file_fmt="%s\n"
dir_fmt="%s\n"
def walk(top):
global strout
try:
names = os.listdir(top)
except os.error:
return
strout.write("\n")
for name in names:
fullname = join(top, name)
if isdir(fullname):
strout.write( dir_fmt%name)
walk(fullname)
elif isfile(fullname):
fullname=toUnixPathName(fullname)
strout.write( file_fmt%(fullname,name))
strout.write("
\n")
import string
def toUnixPathName(path):
comp=string.split(path,":")
if comp[0] == "":
comp[0]="."
return string.join(comp,"/")
walk(":")
print html_doc%strout.getvalue()