copy

Contents

copy#

copy(src: str | CloudPath | Path, dst: str | CloudPath | Path) CloudPath | Path[source]#

Copy a file or a directory (recursively) with copytree or copy2.

Parameters:
  • src (AnyPathStrType) – Source Path

  • dst (AnyPathStrType) – Destination Path (file or folder)

Returns:

New path

Return type:

AnyPathType

Examples

>>> src = 'D:/path/to/copy'
>>> dst = 'D:/path/to/output'
>>> copy(src, dst)
copydir 'D:/path/to/output/copy'
>>> src = 'D:/path/to/copy.txt'
>>> dst = 'D:/path/to/output/huhu.txt'
>>> copyfile = copy(src, dst)
'D:/path/to/output/huhu.txt' but with the content of copy.txt