def filenames(directory, tag='', sorted=False, recursive=False):
    if recursive:
        f = [os.path.join(directory, f) for directory, _, filename in os.walk(directory) for f in filename if f.find(tag) > -1] 
    else:
        f = [os.path.join(directory, f) for f in os.listdir(directory) if f.find(tag) > -1]
    if sorted:
        f.sort()
    return f