On Tue, 8 Mar 2005 14:33:59 +0100, Thomas Rademacher <[EMAIL PROTECTED]> wrote: > Hello, > > I want to collect with the wildcard '*' all existing directories. > For example: /dir/dir/*/dir/*/dir/* or C:\dir\dir\*\dir\*\dir\*
How about something like: import fnmatch import os root = 'd:\\' filter = r'*\*python*\*' for dirpath, dirnames, filenames in os.walk(root): if fnmatch.fnmatch(dirpath, filter): print 'matched', dirpath -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mailman/listinfo/python-list