from pathlib import Path


def get_file_list(data_dir):
    """ retrieve a list of files inside a folder """
    dir_path = Path(data_dir)
    assert dir_path.is_dir()
    file_list = []
    for x in dir_path.iterdir():
        if x.is_file():
            file_list.append(x)
        elif x.is_dir():
            file_list.extend(get_file_list(x))
    return file_list