def globlookup ( pattern , root ) : for subdir , dirnames , filenames in os . walk ( root ) : d = subdir [ len ( root ) + 1 : ] files = ( os . path . join ( d , f ) for f in filenames ) for f in fnmatch . filter ( files , pattern ) : yield f
how to get files matching to some pattern from sftp server directory using python
globlookup finds filesystem objects whose relative path matches the given pattern .
def globlookup(pattern, root):
    """globlookup finds filesystem objects whose relative path matches the
    given pattern.

    :param pattern: The pattern to wish to match relative filepaths to.
    :param root: The root director to search within.

    """
    for subdir, dirnames, filenames in os.walk(root):
        d = subdir[len(root) + 1:]
        files = (os.path.join(d, f) for f in filenames)
        for f in fnmatch.filter(files, pattern):
            yield f