-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakezip.py
More file actions
21 lines (20 loc) · 733 Bytes
/
makezip.py
File metadata and controls
21 lines (20 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os
import zipfile
with zipfile.ZipFile("files.zip", "w") as zf:
for dirname, subdirs, files in os.walk("./"):
if dirname == './':
for filename in files:
if filename in ['files.zip', '.gitignore', 'README.md', 'LICENSE']:
continue
zf.write(filename)
continue
continuehere = False
for notallowed in ['./checkpoints', './.git', './.idea', './report', './paper']:
if dirname.startswith(notallowed):
continuehere = True
break
if continuehere:
continue
zf.write(dirname)
for filename in files:
zf.write(os.path.join(dirname, filename))