Did I find the right examples for you? yes no

All Samples(7)  |  Call(7)  |  Derive(0)  |  Import(0)
Walk a directory tree, using a generator.
This implementation returns only the files in all the subdirectories.
Beware, this is a generator.
Args:
a_dir: A root directory from where to list
a_wildcards: Filtering wildcards a la unix

        def ordered_dirwalk(a_dir, a_file_wildcards= '*', a_dir_ignore_list = [], sort_func = sorted):#pylint:disable=W0102
    """
        Walk a directory tree, using a generator.
        This implementation returns only the files in all the subdirectories.
        Beware, this is a generator.
        Args:
        a_dir: A root directory from where to list
        a_wildcards: Filtering wildcards a la unix
    """

    
    sub_dirs = []
    for the_file in sort_func(os.listdir(a_dir)):
        fullpath = os.path.join(a_dir, the_file)
        if os.path.isdir(fullpath):
            sub_dirs.append(fullpath) #it is a sub_dir
        elif fnmatch.fnmatch(fullpath, a_file_wildcards):
            yield fullpath
        
    #iterate over sub_dirs
    for sub_dir in sort_func(sub_dirs):
        if os.path.basename(sub_dir) not in a_dir_ignore_list:
            for p_elem in ordered_dirwalk(sub_dir, a_file_wildcards):
                yield p_elem 
        else:
            LOG.debug("Ignore subdir %s" % (sub_dir))
        


src/g/m/gmvault-HEAD/src/gmv/gmvault_db.py   gmvault(Download)
        chat_dir = '%s/%s' % (self._db_dir, self.CHATS_AREA)
        if os.path.exists(chat_dir):
            the_iter = gmvault_utils.ordered_dirwalk(chat_dir, "*.meta")
 
            #get all ids
        if pivot_dir == None:
            #the_iter = gmvault_utils.dirwalk(self._db_dir, "*.meta")
            the_iter = gmvault_utils.ordered_dirwalk(self._db_dir, "*.meta", ignore_sub_dir)
        else:
 
 
            #create all iterators and chain them to keep the same interface
            iter_dirs = [gmvault_utils.ordered_dirwalk('%s/%s' \
                        % (self._db_dir, the_dir), "*.meta", ignore_sub_dir) for the_dir in dirs]
 

src/g/m/gmvault-1.8.1-beta/src/gmv/gmvault_db.py   gmvault(Download)
        chat_dir = '%s/%s' % (self._db_dir, self.CHATS_AREA)
        if os.path.exists(chat_dir):
            the_iter = gmvault_utils.ordered_dirwalk(chat_dir, "*.meta")
 
            #get all ids
        if pivot_dir == None:
            #the_iter = gmvault_utils.dirwalk(self._db_dir, "*.meta")
            the_iter = gmvault_utils.ordered_dirwalk(self._db_dir, "*.meta", ignore_sub_dir)
        else:
 
 
            #create all iterators and chain them to keep the same interface
            iter_dirs = [gmvault_utils.ordered_dirwalk('%s/%s' \
                        % (self._db_dir, the_dir), "*.meta", ignore_sub_dir) for the_dir in dirs]
 

src/g/m/gmvault-HEAD/src/sandbox_tests.py   gmvault(Download)
        import gmv.gmvault_utils as gmvu
 
        for vals in gmvu.ordered_dirwalk('/home/aubert/gmvault-db.old/db', a_wildcards="*.meta"):
            print("vals = %s\n" % (vals))
            pass