import pathlib


def explore_path(target: pathlib.Path, recursive=False):
    """Explore paths add return a list of files found"""
    targets = list()

    if target.is_dir():
        for sub in target.iterdir():
            if sub.name.startswith("."):
                continue

            if sub.is_dir():
                if recursive:
                    targets += explore_path(sub, recursive)
            else:
                targets.append(sub)

    else:
        targets.append(target)

    return targets