[Tutor] recursive glob -- recursive dir walk

Martin Walsh mwalsh at mwalsh.org
Wed Jun 10 15:11:26 CEST 2009

spir wrote:
> Hello,
> A foolow-up ;-) from previous question about glob.glob().
> I need to 'glob' files recursively from a top dir (parameter). Tried to use os.walk, but the structure of its return value is really unhandy for such a use (strange, because it seems to me this precise use is typical). On the other hand, os.path.walk seemed to meet my needs, but it is deprecated.

I often use Fredrik Lundh's implementation, when I need a recursive
'glob'. And even though it was contributed some time ago, it appears to
be 3.x compatible.



More information about the Tutor mailing list