[ create a new paste ] login | about

Link: http://codepad.org/ShbrDxt1    [ raw code | fork ]

Python, pasted on May 31:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import cgi
FOLDER = './cgi-bin/'
def files():
    import os, stat, time
    ret  = '<hr />\n'
    ret += '<table cellpadding="7">\n'
    ret += '<tr><th> name </th><th> size </th><th> date </th></tr>\n'
    for fname in sorted(os.listdir(FOLDER)):
        fname = normalize(fname)
        ret += '<tr>'
        ret += '<td><tt>' + cgi.escape(fname) + '</tt></td>'
        pname = os.path.join(FOLDER, fname)
        st = os.stat(pname)
        ret += '<td align="right">' + str(st[stat.ST_SIZE]) + '</td>'
        ret += '<td>' + time.ctime(st[stat.ST_MTIME]) + '</td>'
        ret += '</tr>\n'
    ret += '</table>\n'
    ret += '<hr />\n'
    return ret


Create a new paste based on this one


Comments: