diff --git a/myresources/crocodile/file_management.py b/myresources/crocodile/file_management.py index e1e58c22..9bae0a34 100644 --- a/myresources/crocodile/file_management.py +++ b/myresources/crocodile/file_management.py @@ -280,10 +280,10 @@ def zip(self, path=None, folder=None, name=None, arcname=None, inplace=False, ve with install_n_import("py7zr").SevenZipFile(file=path, mode=mode, password=pwd) as archive: archive.writeall(path=str(slf), arcname=None) else: if (arcname := P(arcname or slf.name)).name != slf.name: arcname /= slf.name # arcname has to start from somewhere and end with filename - if slf.is_file(): path = Compression.zip_file(ip_path=slf, op_path=path + f".zip" if path.suffix != ".zip" else path, arcname=arcname, **kwargs) + if slf.is_file(): path = Compression.zip_file(ip_path=slf, op_path=path + f".zip" if path.suffix != ".zip" else path, arcname=arcname, mode=mode, **kwargs) else: root_dir, base_dir = (slf, ".") if content else (slf.split(at=str(arcname[0]))[0], arcname) - path = Compression.compress_folder(root_dir=root_dir, op_path=path, base_dir=base_dir, fmt='zip', **kwargs) + path = Compression.compress_folder(root_dir=root_dir, op_path=path, base_dir=base_dir, fmt='zip', **kwargs) # TODO: see if this supports mode return self._return(path, inlieu=False, inplace=inplace, operation="delete", orig=orig, verbose=verbose, msg=f"ZIPPED {repr(slf)} ==> {repr(path)}") def unzip(self, folder=None, fname=None, verbose=True, content=False, inplace=False, overwrite=False, orig=False, pwd=None, tmp=False, pattern=None, merge=False, **kwargs) -> 'P': if tmp: return self.unzip(folder=P.tmp().joinpath("tmp_unzips").joinpath(randstr()), content=True).joinpath(self.stem)