-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathscript-zip-source.py
More file actions
23 lines (18 loc) · 913 Bytes
/
Copy pathscript-zip-source.py
File metadata and controls
23 lines (18 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
import py7zr
# noinspection PyPep8Naming
def zipFolder(folderPath: str, outputPath: str, password=None, excludeFolders=None, excludeFiles=None):
if not excludeFolders:
excludeFolders = []
if not excludeFiles:
excludeFiles = []
with py7zr.SevenZipFile(outputPath, 'w', password=password) as zipf:
for root, dirs, files in os.walk(folderPath):
dirs[:] = [d for d in dirs if d not in excludeFolders]
for file in files:
if file not in excludeFiles:
filePath = os.path.join(root, file)
zipf.write(filePath)
if __name__ == "__main__":
zipFolder("./FluentUI", "./source.zip", "zhuzichu988", ["__pycache__"], ["resource_rc.py"])
zipFolder("./", "./source_all.zip", "zhuzichu988", [".git", "venv", "__pycache__", "dist", "build"], ["resource_rc.py", "source.zip", "source_all.zip"])