Created
December 16, 2022 01:46
-
-
Save dbwodlf3/cfb407eb0f0bb9189ddc54f97a37156e to your computer and use it in GitHub Desktop.
unzip many files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
import zipfile | |
root_dir_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "8")); | |
dirs = os.listdir(root_dir_path); | |
for dir in dirs: | |
if(not re.match(".*_file_", dir)): continue; | |
files = os.listdir(os.path.join(root_dir_path, dir)); | |
for file in files: | |
if(not re.match(".*\.zip", file)): continue; | |
abs_dir = os.path.join(root_dir_path,dir); | |
with zipfile.ZipFile(os.path.join(abs_dir,file), 'r') as zip_ref: | |
zip_ref.extractall(abs_dir); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment