Hi all, I have the following code to traverse a directory structure from a given path:
import os, fnmatch, re folders = [] r = re.compile(r'file_filter') # msn_username is passed by the user def browse(junk, dirpath, namelist): for name in namelist: if r.search(name): folders.append(os.path.join(dirpath, name)) userbase = os.environ['USERPROFILE'] # change directory to user profile folder os.chdir(userbase) os.path.walk(os.getcwd(), browse, None) Now with the sample above I need global variables ("folders") to keep track of the directories traversed. Ideally I'd like to either have the browse function return a value that I could use or I'd like the ability to pass on arguments to the browse function, which I can't seem to be able to. Any help would be appreciated. Chrs j. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor