from pathlib import Path


def get_dir_size(path):
    """
    Recursively get the size of a directory, in bytes.
    @param path: Path to the directory
    @return: Directory size in bytes.
    """
    # https://stackoverflow.com/a/1392549/1692112
    return sum(f.stat().st_size for f in Path(path).glob('**/*') if f.is_file())