How to extract them in python scripts by using shutil or somethings
import os
import shutil
directory = os.path.join(os.getcwd(), "BDP Raw data")
def extract(path,director,check):
if check:
shutil.unpack_archive(path, directory)
if check == False:
shutil.unpack_archive(path, directory,'tar')
def extractzip():
for file in os.listdir(directory):
if file.endswith('.zip'):
file_path = f"{directory}\{file}"
extract(file_path,directory,True)
for file in os.listdir(directory):
if file.startswith('9050') or file.startswith('9070'):
directory_path = f"{directory}\{file}"
for file in os.listdir(directory_path):
extractTo000 = f"{directory}\TestExtract000"
extract_path000 = f"{directory_path}\{file}"
extract(extract_path000,extractTo000,False)
extractzip()
Output should be like this method :
Then I must get this: