570 likes | 694 Views
import re, os. from os.path import join, isfile. from fnmatch import fnmatch. def tree_iter(dir):. for root, dirs, files in os.walk(dir):. for f in files:. yield (root,f). def dir_iter(dir):. for p in os.listdir(dir):. if isfile(join(dir,p)):. yield (dir,p).
E N D
dir, # string, where to start the search
do_subdirs, # boolean, whether or not dwelve into subdirs
filemask, # string, a filemask like *.py
search_text, # string, the search expression
is_regex, # boolean, whether or not search_text is a regular expression
update_callback, # a function which takes a string of a filename
cancel_callback): # if this parameterless function returns True,
# the search is canceled.
"""Calls update_callback for every file satisfying the search request specified