Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IPython Jupyter: uploading folder

Can you upload entire folders in IPython Jupyter? If so, how? I know how to upload individual files, of course, but this can get tedious if there are a large number of files and/or subdirectories.

like image 802
Sergei Wallace Avatar asked Jan 12 '16 02:01

Sergei Wallace


People also ask

Can you upload ZIP file to Jupyter Notebook?

Transform the folder into a . zip file in your computer. Upload the . zip file to jupyter home.

How do I save a folder in a Jupyter Notebook?

Saving a Jupter notebookThere is a disk icon in the upper left of the Jupyter tool bar. Click the save icon and your notebook edits are saved. It's important to realize that you will only be saving edits you've made to the text sections and to the coding windows. You will NOT be saving the results of running the code.


1 Answers

Convert it into a single Zip file and upload that. to unzip the folder use the code down bellow

import zipfile as zf files = zf.ZipFile("ZippedFolder.zip", 'r') files.extractall('directory to extract') files.close() 

However, sometimes you may need to download several files from notebook. There are several ways to do this but the easiest way is to zip a directory and download the zip file:

import shutil shutil.make_archive(output_filename_dont_add_.zip, 'zip', directory_to_download) 
like image 58
Afshin Amiri Avatar answered Sep 22 '22 04:09

Afshin Amiri