
Oct. 19, 2022
1:14 a.m.
On 10/18/22, Todd <toddrjen@gmail.com> wrote:
So I think it would make a lot of sense to include copying inside pathlib. I propose adding a `copy` method to `pathlib.Path` (for concrete paths).
The specific call signature would be:
copy(dst, *, follow_symlinks=True, recursive=True, dir_exist_ok=True)
This will call `shutil.copytree` for directories if recursive is True, or `copy2` if recursive if False. For files it will call `copy2` always.
FYI, Barney Gale also proposed implementing copy() and copytree() methods recently. Barney is working on a significant restructuring of pathlib. https://discuss.python.org/t/incrementally-move-high-level-path-operations-f...