◐ Shell
clean mode source ↗

GH-73991: Add `pathlib.Path.move()` by barneygale · Pull Request #122073 · python/cpython

@barneygale barneygale commented

Jul 21, 2024

edited

Loading

Copy link Copy Markdown

Contributor

Add a Path.move() method that moves a file or directory tree, and returns a new Path instance pointing to the target.

This method is similar to shutil.move(), except that it doesn't accept a copy_function argument, and it doesn't check whether the destination is an existing directory.

In pathlib's private ABCs, PathBase.move() uses the copy() and delete() methods to move files and directories.


📚 Documentation preview 📚: https://cpython-previews--122073.org.readthedocs.build/

nineteendo reacted with thumbs up emoji