archive#

archive(folder_path: Union[str, CloudPath, Path], archive_path: Union[str, CloudPath, Path], fmt: str = 'zip') Union[CloudPath, Path][source]#

Archives a folder recursively.

>>> folder_path = 'D:/path/to/folder_to_archive'
>>> archive_path = 'D:/path/to/output'
>>> archive = archive(folder_path, archive_path, fmt="gztar")
'D:/path/to/output/folder_to_archive.tar.gz'
Parameters:
  • folder_path (AnyPathStrType) – Folder to archive

  • archive_path (AnyPathStrType) – Archive path, with or without extension

  • fmt (str) – Format of the archive, used by shutil.make_archive. Choose between [zip, tar, gztar, bztar, xztar]

Returns:

Archive filename

Return type:

str