MCPcopy Index your code
hub / github.com/RustPython/RustPython / removedirs

Function removedirs

Lib/os.py:243–263  ·  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

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

Callers 1

renamesFunction · 0.85

Calls 2

rmdirFunction · 0.50
splitMethod · 0.45

Tested by

no test coverage detected