from pathlib import Path
import re


def getfiles(path, ext):
    """Returns the sorted list of file names with a given 
    extension in a directory."""
    files = Path(path).glob('*.' + ext)
    return sorted(files, 
        key=lambda path: int(re.sub('\D', '', str(path))))