summaryrefslogtreecommitdiff
path: root/zip_experiments.py
blob: 39a972b8628091c97d62a6af9c7e72e0e6bdcd90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os
import zipfile
from sbhs_server import settings

# experiments_dir = settings.EXPERIMENT_LOGS_DIR

def zipdir(path, ziph):
    # ziph is zipfile handle
    for root, dirs, files in os.walk(path):
            for file in files:
                ziph.write(os.path.join(root,file))

if __name__ == '__main__':
    if os.path.exists('Experiments.zip'):
        os.remove('Experiments.zip')
    zipf = zipfile.ZipFile('Experiments.zip','w',zipfile.ZIP_DEFLATED)
    zipdir('experiments/',zipf)
    zipf.close()