from pathlib import Path
from typing import List


def _list_files(d: Path) -> List[Path]:
    """ Recursively list files in a dir and its sub dirs """
    if d.is_file():
        return [d]
    else:
        sub_dirs = [d for d in d.iterdir() if d.is_dir()]
        files = [f for f in d.iterdir() if f.is_file()]
        for d in sub_dirs:
            files += _list_files(d)
        return files