Reputation: 103
I know it's possible to download files from Google Colaboratory. At the moment I do this via files.download(). But is it possible to download a created directory in Colab?
I know how to code the unique ID and I will search for creating the masks. But in fact I have to download the directory directory_name with the same structure shown at the end (this saves time for me instead of running the code for it in Colab every time again after reconnecting to the VM).
So the question is: Is there any function to download the whole directory as a folder instead of downloading every image / mask for its own?
I want to make such a directory:
directory_name
... id_1
........ images
............... one image with id_1
........ masks
............... all the masks for the images (different ids)
Upvotes: 5
Views: 14857
Reputation: 283
Too late to answer this, but here's what you can do to download a folder from colab to your local system:
1. Create a zipped file in colab by:
import shutil
shutil.make_archive('folder_name', 'zip', 'folder_name')
2. Download the zipped file: right click file > Download Just unzip this when you want to use it later by:
! unzip -q zip_file_name.zip
Hope that answers your query!
Upvotes: 15
Reputation: 161
Download the folder directly from the files tab that you can find on an arrow on top left of the screen https://colab.research.google.com/notebooks/io.ipynb
Upvotes: 1