add_to_zip#
- add_to_zip(zip_path: str | CloudPath | Path, dirs_to_add: list | str | CloudPath | Path) CloudPath | Path [source]#
Add folders to an already existing zip file (recursively).
- Parameters:
zip_path (AnyPathStrType) – Already existing zip file
dirs_to_add (Union[list, AnyPathStrType]) – Directories to add
- Returns:
Updated zip_path
- Return type:
AnyPathType
Example
>>> zip_path = 'D:/path/to/zip.zip' >>> dirs_to_add = ['D:/path/to/dir1', 'D:/path/to/dir2'] >>> add_to_zip(zip_path, dirs_to_add) zip.zip contains 2 more folders, dir1 and dir2