def matching_fpaths(dpath_list, include_patterns, exclude_dirs=[],
                    greater_exclude_dirs=[], exclude_patterns=[],
                    recursive=True):
    r
    if isinstance(dpath_list, six.string_types):
        dpath_list = [dpath_list]
    for dpath in dpath_list:
        for root, dname_list, fname_list in os.walk(dpath):
            subdirs = pathsplit_full(relpath(root, dpath))
            if any([dir_ in greater_exclude_dirs for dir_ in subdirs]):
                continue
            if basename(root) in exclude_dirs:
                continue
            _match = fnmatch.fnmatch
            for name in fname_list:
                if any(_match(name, pat) for pat in include_patterns):
                    if not any(_match(name, pat) for pat in exclude_patterns):
                        fpath = join(root, name)
                        yield fpath
            if not recursive:
                break