Re: Removing hidden directory in os.walk()
On Fri, Feb 25, 2011 at 9:40 AM, Gaëtan Podevijn <firstname.lastname@example.org> wrote:
> 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('.')]
|All times are GMT. The time now is 04:48 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.