from pathlib import Path


def filelist(dirpath='.', string='*'):
    """Returns a list with all the files containg `string` in its name.

    Note:
        List is sorted by the filename.

    Args:
        dirpath (str or pathlib.Path, optional): list with full file directory
        paths.
        string (str, optional): string to look for in file names.

    Return:
        list

    See Also:
        :py:func:`parsed_filelist`
    """
    dirpath = Path(dirpath)

    if '*' not in string:
        string = '*' + string + '*'

    temp = list(dirpath.glob(string))

    temp2 = [filepath.name for filepath in temp]

    return [x for _,x in sorted(zip(temp2,temp))]