Reputation: 607
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
Upvotes: 21
Views: 33941
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
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
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
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