Created
May 8, 2024 16:11
-
-
Save heathhenley/6d10f17bdb8345c0f4f2a8fa7477e3e5 to your computer and use it in GitHub Desktop.
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 pathlib | |
import zipfile | |
main_dir = r"folder_with_a_bunch_of_zips" | |
# extract a zip file windows | |
def extract_zip(zip_file): | |
with zipfile.ZipFile(zip_file, 'r') as zip_ref: | |
zip_ref.extractall(zip_file.parent) | |
print(f"Extracted {zip_file.name}") | |
def extract_zips(main_dir): | |
main_dir = pathlib.Path(main_dir) | |
for file in main_dir.iterdir(): | |
if file.suffix != ".zip": | |
continue | |
print(file.name) | |
extract_zip(file) | |
extract_zips(main_dir) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment