Displaying files in a directory

General discussion for off-topic subjects.
arawra
Senior Member
Posts: 190
Joined: Fri Jun 21, 2013 6:51 am

Displaying files in a directory

Postby arawra » Thu Jan 23, 2014 1:07 am

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

Return to “Whatever”

Who is online

Users browsing this forum: No registered users and 18 guests