On Fri, Feb 25, 2011 at 9:40 AM, Gaëtan Podevijn <[email protected]> wrote:
> Hello,
> I would like that os.walk() does not walk through hidden directories. I know
> that with topdow = true, I can modify the subdirectory list in place, but
> how should I remove every hidden directory from this place in list ?
Assuming you're on *nix:
for dirpath, dirnames, filenames in os.walk(top):
dirnames[:] = [d for d in dirnames if not d.startswith('.')]
do_whatever()
Cheers,
Chris
--
http://blog.rebertia.com
--
http://mail.python.org/mailman/listinfo/python-list