# listDirTree.py
# Written by Todd Wareham for CS 2500
"""
Print a list (sorted by name) of all readable files in the directory
 tree rooted at the current directory with the size in bytes of each file.
"""

import sys
import os

def procDir(arg, dirname, files):
    for filename in sorted(files):
        if os.access(filename, os.R_OK):
            path = os.path.join(os.path.abspath(dirname), filename)
            print "%-60s [%8d bytes]" % (path, os.path.getsize(path))



if len(sys.argv) != 1:
    print "usage:", sys.argv[0]
    sys.exit(1)

os.path.walk(".", procDir, [])
    

