#! /usr/bin/env python import sys, os, string, stat def processjpeg(jpegpath): haveThumb = " No Thumb" entryname = os.path.split(jpegpath)[1] thumbName = os.path.split(jpegpath)[0]+'/thumbs/'+entryname # print thumbName if os.path.isfile(thumbName): haveThumb = "Thumb" % (thumbName) fstat = os.stat(jpegpath) number = fstat[stat.ST_SIZE]/1000 # add in the file's size print "%12s %3d %s %s" % (entryname, number, jpegpath, entryname, haveThumb) def processhtml(filename): print "%12s HTML file "%(filename) def processdir(dir, level): randoms = 0 anything = 0 print " processdir %s level %d" % (os.path.abspath(dir), level) filenames = os.listdir(os.path.abspath(dir)) for filename in filenames: # print "filename %s isdir %d"%(filename,os.path.isdir(os.path.abspath(dir)+'/'+filename)) ext = os.path.splitext(filename)[1] if ext == '.htm' or ext == '.html': anything = 1 processhtml(os.path.abspath(dir)+'/'+filename) for filename in filenames: ext = os.path.splitext(filename)[1] if ext == '.jpg' or ext == '.gif' or ext == 'png': anything = 1 processjpeg(os.path.abspath(dir)+'/'+filename) elif ext == '.txt': processhtml(os.path.abspath(dir)+'/'+filename) else: randoms = randoms+1 for filename in filenames: if filename == 'thumbs': return if filename == 'code': return if filename == 'private': return if filename == '.xvpics': print "found XVPICS "+os.path.abspath(dir) return fullpath = os.path.abspath(dir)+'/'+filename if os.path.isdir(fullpath): processdir(fullpath,level+1) if anything != 0: print "finished with %s found %d randoms - includes dirs" % (fullpath, randoms) def main(): print "" print "" print "" print "" print "index of files
"
    
    processdir(os.curdir,0)

    print "
" if __name__ == '__main__': main()