JupyterHubUploadDownload: Difference between revisions

From CSDMS
m (Be bold)
m (Directory download)
Line 1: Line 1:
{{PageTitle|OpenEarthscape JupyterHub: Uploading and Downloading Files}}
{{PageTitle|OpenEarthscape JupyterHub: Downloading and uploading files}}


Uploading and downloading individual files from a JupyterHub is straightforward,
Uploading and downloading individual files from a JupyterHub is straightforward,
Line 19: Line 19:
= A problem and a solution =
= A problem and a solution =


'''Problem''': The examples above only work for individual files. What if you want to download or upload multiple files?
'''Problem''':
The examples above only work for individual files.
What if you want to download or upload multiple files?


'''Solution''': Group files into a directory and create an archive file, such as a zip file or tarball, then download/upload the archive file.
'''Solution''':
Group files into a directory and create an archive file,
such as a zip file or tarball,
then download/upload the archive file.
 
In the examples that follow,
we'll use zip files;
while they don't offer the best compression,
they're well-supported across Linux, macOS, and Windows.


= Download a directory =  
= Download a directory =  


First, an example of downloading a directory.
On the JupyterHub, open a terminal.
Locate the directory you want to download.
For example, I'd like to download a directory called <code>tmp</code>.
Zip it up:


Open a terminal.
$ zip -rT tmp.zip tmp
Locate the directory you want to download.
 
Zip it up.
then use the instructions above to download the file <code>tmp.zip</code> to your local computer.
Use the download instructions above.
 
To unpack the zip file on your local computer,
you can either double click on it in your operating system's file manager,
or you can use unzip it in a terminal:


On you local machine you can either double click on the zip file in your file manager to uncompress it,
$ unzip tmp.zip
or you can use unzip in a terminal.


= Upload a directory =
= Upload a directory =

Revision as of 15:25, 26 April 2022

OpenEarthscape JupyterHub: Downloading and uploading files

Uploading and downloading individual files from a JupyterHub is straightforward, but the process for multiple files is trickier. We'll go over a few examples here.

Download a file, upload a file

To download a file to your local computer, right-click on the file in the JupyterHub File Browser and select Download, as shown in Figure 1 below.

To upload a file from your local computer to the JupyterHub, click on the upload button at the top of the JupyterHub File Browser, as shown in Figure 2 below.

A problem and a solution

Problem: The examples above only work for individual files. What if you want to download or upload multiple files?

Solution: Group files into a directory and create an archive file, such as a zip file or tarball, then download/upload the archive file.

In the examples that follow, we'll use zip files; while they don't offer the best compression, they're well-supported across Linux, macOS, and Windows.

Download a directory

On the JupyterHub, open a terminal. Locate the directory you want to download. For example, I'd like to download a directory called tmp. Zip it up:

$ zip -rT tmp.zip tmp

then use the instructions above to download the file tmp.zip to your local computer.

To unpack the zip file on your local computer, you can either double click on it in your operating system's file manager, or you can use unzip it in a terminal:

$ unzip tmp.zip

Upload a directory

Second, an example of uploading a directory.

On your local machine, find the directory of files you'd like to upload. Zip the directory, either with the file manager or the zip command on a terminal. Use the upload instructions above. On the JupyterHub, open a terminal. Unzip the file.

Fin.