1234567891011121314 |
- import zipfile
- from pathlib import Path
- def unzip_file(filename, target):
- subdir = Path(filename).name[:-4]
- target_subdir = target + "/" + subdir
- Path(target_subdir).mkdir()
- with zipfile.ZipFile(filename, "r", compression=zipfile.ZIP_DEFLATED, compresslevel=9) as zip:
- zip.extractall(target_subdir)
- if __name__ == "__main__":
- unzip_file("app/temp/zip_files/loeffler-c11_2022-07-08_112547.zip", "app/temp/unzipped")
|