copy#

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

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

>>> 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
Parameters:
  • src (AnyPathStrType) – Source Path

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

Returns:

New path

Return type:

AnyPathType