from pathlib import Path


def calc_size(p : Path, nice=True):
    """Calculate size of directory and all subdirs

    Parameters
    ----------
    p : Path
        [description]
    nice : bool, optional
        return raw float or nicely formatted string, default False

    Returns
    -------
    int | string
        size of folder
    """    
    _size = sum(_p.stat().st_size for _p in p.glob('**/*') if _p.is_file())
    return _size