IPython Jupyter: uploading folder
Maybe it is easier to just use unix to just unzip the data.
Steps:
Transform the folder into a .zip file in your computer.
Upload the .zip file to jupyter home.
In jupyter notebook run
! unzip ~/yourfolder.zip -d ~/
where
!
tells the jupyter notebook that you are going to give code directly to unix, not python code
unzip
is the unzip commmand
~/yourfolder.zip
tells the command where your .zip folder is (at ~/
if you uploaded to the home folder)
-d ~/
tells the command where you want to put the unzipped folder (this assumes you want to put it in the home folder, but you can also put it in any other subfolder with -d ~/my_first_level_subfolder
or -d ~/my_first_level_subfolder/my_second_level_subfolder
, etc.)
- If you want to delete the original .zip folder, delete it manually at jupyter home or use
!rm ~/yourfolder.zip
Hope if helps somebody
Put your folder into
C:\Users\'YOUR USER NAME'\
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)