diff options
Diffstat (limited to 'zip_experiments.py')
-rw-r--r-- | zip_experiments.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/zip_experiments.py b/zip_experiments.py new file mode 100644 index 0000000..39a972b --- /dev/null +++ b/zip_experiments.py @@ -0,0 +1,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() |