D wrote: > Hello, > > How can one exclude a directory (and all its subdirectories) when > running os.walk()? Just remove it from the dirnames yielded: <code> import os for dirpath, dirnames, filenames in os.walk ("c:/temp"): print dirpath if "archive" in dirnames: dirnames.remove ("archive") </code> TJG