As a user in a class that runs Jupyter notebooks for assignments, I have access to the assignments via the web interface. I assume the assignments are stored somewhere in my per
The easiest way is to archive all content using tar, but there is also an API for files downloading.
GET /files/_FILE_PATH_
To get all files in folder you can use:
GET /api/contents/work
Example:
curl https://server/api/contents?token=your_token
curl https://server/files/path/to/file.txt?token=your_token --output some.file
Source: Jupyter Docs
I don't think this is possible with wget
, even with the wget -r
option. You may have to download them individually (using the Download option in the dashboard view (which is only available on single, non-directory, non-running notebook items) if that is available to you.
However, it is likely that you are not able to download them since if your teacher is using grading software like nbgrader then the students having access to the notebooks themselves is undesirable - since the notebooks can contain information about the answers as well.
Try running this as separate cell in one of your notebooks:
!tar chvfz notebook.tar.gz *
If you want to cover more folders up the tree, write ../
before the *
for every step up the directory. The file notebook.tar.gz will be saved in the same folder as your notebook.
You can create a new terminal from the "New" menu and call the command described on https://stackoverflow.com/a/47355754/8554972:
tar cvfz notebook.tar.gz *
The file notebook.tar.gz will be saved in the same folder as your notebook.
from google.colab import files
files.download("/content/data.txt")
These lines might work if you are working in a google colab or Jupyter notebook.
The first line imports the library files The second one, downloads your created file, example:"data.txt" (your file name) located in the content.
Try first to get the directory by:
import os
os.getcwd()
And then use snipped from How to create a zip archive of a directory. You can download complete directory by zipping it. Good luck!