copy#

copy(src: Union[str, cloudpathlib.cloudpath.CloudPath, pathlib.Path], dst: Union[str, cloudpathlib.cloudpath.CloudPath, pathlib.Path]) Union[cloudpathlib.cloudpath.CloudPath, pathlib.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 (Union[str, CloudPath, Path]) – Source Path

  • dst (Union[str, CloudPath, Path]) – Destination Path (file or folder)

Returns

New path

Return type

Union[CloudPath, Path]