def filelist(**args): """retun list of files""" ret = [] import os import datetime for wt in os.walk(filespath()): for fn in wt[2]: fpath = os.path.join(wt[0], fn) ret.append([fpath, \ str(datetime.datetime.fromtimestamp(os.stat(fpath).st_mtime)), \ os.stat(fpath).st_size]) return {'files':ret}
def filelist(**args): """retun list of files""" ret = [] import os import datetime for wt in os.walk(filespath()): for fn in wt[2]: fpath = os.path.join(wt[0], fn) ret.append([fpath, \ str(datetime.datetime.fromtimestamp(os.stat(fpath).st_mtime)), \ os.stat(fpath).st_size]) return {'files': ret}
def save(fname, content): """save the file""" f = open(os.path.join(filespath(), fname), 'w+') f.write(content) f.close()