Page 1 of 1

Displaying files in a directory

Posted: Thu Jan 23, 2014 1:07 am
by arawra
Trying to host a page such that it will display all files relevant to my project. However, its not showing anything right now =(.

Code: Select all

    import os
     
    print "Content-type: text/html\n\n"
     
    for file in os.listdir(os.getcwd()):
        if 'index' not in pathFile:
            pathFile = os.getcwd().replace('/var/www/', 'http://thinkplace.tk/') + '/' + file   
            print '<a href="%s">%s</a>'%(pathFile, pathFile)


Image

E: Ok, I derped =p