file find module
Peter Hansen
peter at engcorp.com
Fri Sep 28 23:39:54 EDT 2001
Chris Gonnerman wrote:
> Peter Hansen wrote:
> > Just be careful because glob.glob('*') will not return filenames
> > that start with a period, while glob.glob('.*') will return only
> > such filenames. You need both if you want all files.
>
> Use os.listdir() and write your own matching function if the dotfiles
> become a problem.
... and write code to prepend the full path to the matched files
... and recurse to support multi-segment matching: glob.glob('*/*/*.c')
... and ? probably some other things that aren't immediately apparent
(It's likely easier to use glob in many cases, which is why
I think it's still a nice option, just one which ought to have
improved documentation for non-Unix heads...)
--
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com
More information about the Python-list
mailing list