Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)

        def _list_dir(target_dir, log):
    total_size=0
    dir_out=u'== directory %s\r\n  epoch   |          time          |      size     |    filename\r\n' % target_dir
    for filename in os.listdir(target_dir): # if target_dir is unicode, return os.listdir return unicode
        full_filename=os.path.join(target_dir, filename)
        stat=os.stat(full_filename)
        if os.path.isdir(full_filename):
            size=''
        else:
            size='%15d' % stat.st_size
            total_size+=stat.st_size
        dir_out+='%d %s %15s %s\r\n' % (stat.st_mtime, time.ctime(stat.st_mtime), size, filename)
        
    return dir_out, total_size
        


src/m/k/mksbackup-1.0.4/mksbackuplib/windows.py   mksbackup(Download)
def windows_list_dir(target_dir, log, encoding=default_encoding):
    try:
        dir_out, total_size=archiver._list_dir(target_dir, log) 
    except Exception, e:
        log.error('listing target directory: %s', WindowsErrorDecode(e, encoding))