hydroshare / hydroshare-jupyterhub

The HydroShare Jupyterhub Notebook Server is an environment designed provide added value to existing HydroShare resources via interactive computational notebooks.
4 stars 6 forks source link

Save a directory and its files back into HydroShare #116

Open amabdallah opened 6 years ago

amabdallah commented 6 years ago

Is there a way to save a folder back to HydroShare?

I tried to save the folder "HydraLib" which has lots of files inside that but it gave me this mixed meaning message and I thought to share it in case you guys could improve it

files = ['HydraLib','WaMDaM_Hydra.ipynb','WEAP_test3.xlsm'] image

amabdallah commented 6 years ago

In an email conversation, Tony suggested this solution

This can be done by:

1.) zipping your directory from with your notebook:

import shutil      
shutil.make_archive('mydir', 'zip', [path to folder])

2.) saving the *.zip file to your resource, e.g:

files = ['mydir.zip','...', '...']
3.) unzip it from the HS resource edit page by right-clicking on the *.zip file .

This process can be automated using the REST api, but I haven’t had a chance to implement it in JH yet.