Alex Martin
Alex Martin

Reputation: 607

Downloads folder from JupyterLab

I'd like to download a folder of pickle files from Jupyterlab (running on a google cloud instance) and I'm unable to find a way to do so. Apparently, downloading individual files is permitted but I have about 500 individuals pickle files in my folder to download and so would take while to do that manually.

As you can see in the menu below (when right click on the folder I want to download) I manage to install a "download folder as archive" extension but for some reasons the resulting zip format is unreadable locally. I'm sure there must be a way of downloading folder easily from Jupyterlab and any help would be highly appreciated. Thank you

enter image description here

Upvotes: 21

Views: 33941

Answers (4)

Sebastian Scholl
Sebastian Scholl

Reputation: 1105

From inside your notebook, add a function or cell for creating a zip:

import shutil

shutil.make_archive(output_file_name, 'zip', folder_path)

Then just download the zip file from the Jupyter server.

Upvotes: 0

Mohamed BOUSSAKSSOU
Mohamed BOUSSAKSSOU

Reputation: 421

On you notebook try this

!zip -r example.zip original_folder

by adding ! you tell the notebook that you wanna execute external commands

Upvotes: 10

Frumda Grayforce
Frumda Grayforce

Reputation: 179

You can also open a bash terminal, pack all desired files into an archive

tar -czf ARCHIVE_NAME.tar.gz FOLDER1 FOLDER2

and then download them. It might be necessary to move the archive into your virtual home folder in order to see it in the file browser on the left side though.

Upvotes: 5

Alex Martin
Alex Martin

Reputation: 607

I finally find a solution by zipping the folder using the following command:

    zip -r example.zip original_folder

And it worked.

Upvotes: 23

Related Questions