MCPcopy Index your code
hub / github.com/python/cpython / removedirs

Function removedirs

Lib/os.py:254–274  ·  view source on GitHub ↗

removedirs(name) Super-rmdir; remove a leaf directory and all empty intermediate ones. Works like rmdir except that, if the leaf directory is successfully removed, directories corresponding to rightmost path segments will be pruned away until either the whole path is consumed o

(name)

Source from the content-addressed store, hash-verified

252 raise
253
254def removedirs(name):
255 """removedirs(name)
256
257 Super-rmdir; remove a leaf directory and all empty intermediate
258 ones. Works like rmdir except that, if the leaf directory is
259 successfully removed, directories corresponding to rightmost path
260 segments will be pruned away until either the whole path is
261 consumed or an error occurs. Errors during this latter phase are
262 ignored -- they generally mean that a directory was not empty.
263
264 """
265 rmdir(name)
266 head, tail = path.split(name)
267 if not tail:
268 head, tail = path.split(head)
269 while head and tail:
270 try:
271 rmdir(head)
272 except OSError:
273 break
274 head, tail = path.split(head)
275
276def renames(old, new):
277 """renames(old, new)

Callers 1

renamesFunction · 0.85

Calls 2

rmdirFunction · 0.85
splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…