如何从Google Colab下载多个文件或整个文件夹? [英] How do I download multiple files or an entire folder from Google Colab?

查看:268
本文介绍了如何从Google Colab下载多个文件或整个文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我可以使用命令

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')))

如何将多个文件作为文件夹下载到本地计算机?或者如何将这些文件作为文件夹上传到我的Google驱动器?

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?

推荐答案

我创建了一个zip文件:

I have created a zip file:

!zip -r /content/file.zip /content/Folder_To_Zip

比我下载了该zip文件还要google.colab导入文件中的

Than I have downloded that zip file:

from google.colab import files
files.download("/content/file.zip")

这篇关于如何从Google Colab下载多个文件或整个文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆