-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunzip_batch.py
More file actions
23 lines (18 loc) · 765 Bytes
/
unzip_batch.py
File metadata and controls
23 lines (18 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 8 09:07:46 2021.
@author: Michael
"""
import os
import zipfile
dir_name = 'C:\\SwisstopoMobility\\analysis\\DataBase\\2021\\February\\10\\rinex'
dir_name = os.path.abspath(dir_name)
extension = ".zip"
os.chdir(dir_name) # change directory from working dir to dir with files
for item in os.listdir(dir_name): # loop through items in dir
if item.endswith(extension): # check for ".zip" extension
file_name = os.path.abspath(item) # get full path of files
zip_ref = zipfile.ZipFile(file_name) # create zipfile object
zip_ref.extractall(dir_name) # extract file to dir
zip_ref.close() # close file
os.remove(file_name) # delete zipped filef