[docs] [issue13779] os.walk: bottom-up

Antoine Pitrou report at bugs.python.org
Mon Jan 16 16:03:22 CET 2012


Antoine Pitrou <pitrou at free.fr> added the comment:

> However, the generated (files? and) dirs do not necessarily reflect the current situation as produced by os.listdir.

What do you mean exactly? Another process has re-created "b" in parallel?
This race condition is pretty impossible to solve in the general case (unless the filesystem is transactional): even if you call os.listdir() again, a new file or dir could appear just before the following call to os.rmdir().

(just for the record, shutil.rmtree already allows you to delete a filesystem tree)

----------
nosy: +pitrou

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13779>
_______________________________________


More information about the docs mailing list