Created
June 7, 2018 19:07
-
-
Save OneGneissGuy/977d8d04c4f229400a6bd800849296b5 to your computer and use it in GitHub Desktop.
unzip a directory of zip files to a destination directory
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
# -*- coding: utf-8 -*- | |
""" | |
Created on Wed Jun 6 11:51:58 2018 | |
unzip a directory of zip files to a destination directory | |
@author: jsaracen | |
""" | |
import zipfile | |
import os | |
source_dir = r"\temp_dir" | |
dest_dir = r"\r_package_dir" | |
file_ext = ".zip" | |
for root, dirs, files in os.walk(source_dir): | |
for file in files: | |
if file.endswith(file_ext): | |
path = os.path.join(root, file) | |
zip_ref = zipfile.ZipFile(path, 'r') | |
zip_ref.extractall(dest_dir) | |
zip_ref.close() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment