How do I download multiple files or an entire folder from Google Colab?
Currently, I can download files as individual files with the command
files.download(file_name)
I also tried uploading them to the drive with the below code snippet but it is uploading them as individual files.
uploaded = drive.CreateFile({'title': file_name})
uploaded.SetContentString('Sample upload file content')
uploaded.Upload()
print('Uploaded file with ID {}'.format(uploaded.get('id')))
How can I download multiple files as a folder to my local computer? Or how can I upload these files as a folder to my google drive?
I have created a zip file:
!zip -r /content/file.zip /content/Folder_To_Zip
Than I have downloded that zip file:
from google.colab import files
files.download("/content/file.zip")
For example, if you have to download log folder:
!zip -r log.zip log/
-r
represent recursive
while log.zip
is destination zip file and
log/
is source folder path