Problem with directory recursion!

Laszlo Nagy gandalf at shopzeus.com
Fri Aug 17 15:24:58 EDT 2007


>
> Does anyone see anything immediately suspicious about the code? 
Yes. os.walk does the recursion for you. Either you should use 
os.listdir instead of os.walk, or use os.walk ONCE and iterate over the 
results. I prefer to use the former because usually I do not remember 
how os.walk works. Read and try the example that is given in the docs:

http://docs.python.org/lib/os-file-dir.html

Best,

   Laszlo




More information about the Python-list mailing list