Zipfiles.py

This commit is contained in:
Chev 2020-08-14 20:26:27 -07:00
parent f9527a2895
commit 69177486f1

13
thunderstore/zipfiles.py Normal file
View file

@ -0,0 +1,13 @@
import os
import zipfile
def zipfiles(z_obj, dir):
for root, dirs, files in os.walk(dir):
for file in files:
file_loc = file if not file.endswith('.dll') else f'plugins/{file}'
z_obj.write(os.path.join(root, file), arcname=file_loc)
for folder in next(os.walk('.'))[1]:
print(f'{folder}/')
with zipfile.ZipFile(f'{folder}.zip', 'w') as z:
zipfiles(z, f'{folder}/')