unzip.py 447 B

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