def find(pattern, path=os.path.curdir, recursive=False):
root = realpath(path)<EOL>Finder = lambda item: regex.is_regex(pattern)and pattern.match(item) or (pattern == item)<EOL>if recursive:<EOL><INDENT>for base, dirs, files in os.walk(root, topdown=True):<EOL><INDENT>for segment in itertools.chain(filter(Finder, files), filter(Finder, dirs)):<EOL><INDENT>yield FS(os.path.join(base, segment))<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>for segment in filter(Finder, os.listdir(root)):<EOL><INDENT>yield(os.path.join(root, segment))<EOL><DEDENT><DEDENT>
Find absolute file/folder paths with the given ``re`` pattern.

Args:
    * pattern: search pattern, support both string (exact match) and `re` pattern.
    * path: root path to start searching, default is current working directory.
    * recursive: whether to recursively find the matched items from `path`, False by default

Returns:
    Generator of the matched items of Files/Folders.