from typing import List
import pathlib


def find_all_coreref_files(directory: str) -> List[pathlib.Path]:
    """Searches for all the COREREF files in a directory and all its subdirectories.

    Parameters
    ----------
    directory: str
        A string containing the path to directory where we want to search the COREREF
        files.

    Returns
    -------
    List[pathlib.Path]
        A list of pathlib.Path objects, pointing to the location of all the discovered
        COREREF files.
    """
    return list(pathlib.Path(directory).glob("**/COREREF*.txt.bz2"))