""")
theindex.writelines([l for l in open(directorypath+"README").readlines()])
theindex.write("
")
theindex.write(middleahtml)
myoutls=commands.getoutput("find "+directorypath+rec+" -type d -print").split("\n")
print "Including the following folder(s):"
for i in sorted(myoutls):
print "\t"+i
i=i.replace(" ","\ ")
#print "ls "+i+"/*.png "+i+"/*.txt " +i+"/*.[jJ][pP][gG]"
#tmp=commands.getoutput("ls "+i+"/*.png "+i+"/*.[jJ][pP][gG] "+i+"/*.gif" ).split("\n")
tmp=commands.getoutput("ls "+i+"/*.png "+i+"/*.txt " +i+"/*.[jJ][pP][gG]" ).split("\n")
tmpsize=len(tmp)
#print tmp
# if((tmp[0].find("No such file or directory"))==-1):
for ii in range(0,tmpsize):
if((tmp[ii].find("No such file or directory"))==-1):
# theindex.write("
"
theindex.write(middlebhtml);
for i in sorted(myoutls):
i=i.replace(" ","\ ")
tmp=commands.getoutput("ls "+i+"/*.png " +i+"/*.[jJ][pP][gG]" ).split("\n")
tmpsize=len(tmp)
#print tmp
for j in range(0,tmpsize):
if((tmp[j].find("No such file or directory"))==-1):
hrefbase="./"
theindex.write(""+re.sub(directorypath, "",tmp[j])+"\n")
theindex.write(bottomhtml)
theindex.close()
except:
parser.print_help()
if __name__ == '__main__':
main()