os.unlinkat() has been removed, update os.fwalk() doc

This commit is contained in:
Victor Stinner 2012-08-05 15:18:02 +02:00
parent 415d0f5cd3
commit 69a6ca5260

View file

@ -2248,7 +2248,7 @@ features:
dirs.remove('CVS') # don't visit CVS directories dirs.remove('CVS') # don't visit CVS directories
In the next example, walking the tree bottom-up is essential: In the next example, walking the tree bottom-up is essential:
:func:`unlinkat` doesn't allow deleting a directory before the directory is :func:`rmdir` doesn't allow deleting a directory before the directory is
empty:: empty::
# Delete everything reachable from the directory named in "top", # Delete everything reachable from the directory named in "top",
@ -2258,9 +2258,9 @@ features:
import os import os
for root, dirs, files, rootfd in os.fwalk(top, topdown=False): for root, dirs, files, rootfd in os.fwalk(top, topdown=False):
for name in files: for name in files:
os.unlinkat(rootfd, name) os.unlink(name, dir_fd=rootfd)
for name in dirs: for name in dirs:
os.unlinkat(rootfd, name, os.AT_REMOVEDIR) os.rmdir(name, dir_fd=rootfd)
Availability: Unix. Availability: Unix.