PyDocs

Nav

Generic Operating System Services

renames

os

function (source)
  • renames(old, new)
renames(old, new)

Super-rename; create directories as necessary and delete any left
empty.  Works like rename, except creation of any intermediate
directories needed to make the new pathname good is attempted
first.  After the rename, directories corresponding to rightmost
path segments of the old name will be pruned until either the
whole path is consumed or a nonempty directory is found.

Note: this function can fail with the new directory structure made
if you lack permissions needed to unlink the leaf directory or
file.
Changed in 3.6
  • 3.6: Accepts a path-like object for old and new.
0 Examples
No examples for os/renames.
See Also
No see-alsos for os/renames
0 Notes
No notes for renames