mirror of
https://github.com/ION606/COGMOD-HWI.git
synced 2026-05-14 22:16:57 +00:00
added base project
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
from pathlib import Path, PurePosixPath
|
||||
import zipfile, fnmatch
|
||||
|
||||
ROOT = Path.cwd()
|
||||
zip_path = ROOT / "report_overleaf.zip"
|
||||
|
||||
exclude = ['*.aux', '*.log', '*.out', '*.pdf', '*.zip', '*.pyc',
|
||||
'__pycache__', '.git*', '*.DS_Store']
|
||||
|
||||
def include(path: Path) -> bool:
|
||||
rel = path.relative_to(ROOT)
|
||||
return not any(fnmatch.fnmatch(rel.as_posix(), pat) for pat in exclude)
|
||||
|
||||
with zipfile.ZipFile(zip_path, "w", zipfile.ZIP_DEFLATED) as zf:
|
||||
for p in ROOT.rglob('*'):
|
||||
if p.is_file() and include(p):
|
||||
zf.write(p, arcname=PurePosixPath(p.relative_to(ROOT)))
|
||||
|
||||
print("archive saved to", zip_path)
|
||||
Reference in New Issue
Block a user