Glob in python which supports the ** wildcard

Simon Brunning simon at brunningonline.net
Tue Nov 23 04:40:00 EST 2010


On 23 November 2010 09:26, Martin Lundberg <martin.lundberg at gmail.com> wrote:
> It does not seem to support the ** wildcard? It will recursively seek
> for files matching a pattern like *.js but it won't support
> /var/name/**/*.js as root, will it?

I did say roughly. ;-) You'd need to do:

for filename in locate("*.js", "/var/name/"):
    print filename

Adding support for ** is left as an exercise for the reader.

-- 
Cheers,
Simon B.



More information about the Python-list mailing list