Blog

Batch Unzip Zip Files

This script will be very useful if you need to unpack a large number of zip files.

where folder_with_zip_files is the name of the folder with zip files.

The result (unpacked files) will be placed in the same folder.

#!/usr/bin/env python3

from zipfile import ZipFile
import glob, os

zfiles = []
folder_with_zip_files = "/home/su/Downloads/unzipping"
os.chdir(folder_with_zip_files )
for file in glob.glob("*.zip"):
    zfiles.append(file)

for zfile in zfiles:
   with ZipFile(zfile, 'r') as zipObj:
      zipObj.extractall()