def get_disk_space(start_path='.'):
    """
    References:
        http://stackoverflow.com/questions/1392413/calculating-a-directory-size-using-python
    """
    total_size = 0
    for root, dname_list, fname_list in os.walk(start_path):
        for fname in fname_list:
            fpath = os.path.join(root, fname)
            try:
                total_size += os.path.getsize(fpath)
            except OSError:
                pass
    return total_size
def get_disk_space ( start_path = '.' ) : total_size = 0 for root , dname_list , fname_list in os . walk ( start_path ) : for fname in fname_list : fpath = os . path . join ( root , fname ) try : total_size += os . path . getsize ( fpath ) except OSError : pass return total_size
References:
        http://stackoverflow.com/questions/1392413/calculating-a-directory-size-using-python