Google Colab:如何挂载特定文件夹而不是挂载根文件夹? [英] Google Colab: How can I mount a particular folder instead of mounting root folder?

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

问题描述

我可以使用以下代码挂载Google驱动器:

I am able to mount Google drive using the code below:

from google.colab import drive
drive.mount('/content/drive')

但是上面安装了Root文件夹,允许驱动器中的所有文件访问.

But the above mounts the Root folder enabling all file access within the drive.

我希望挂载Google驱动器中的特定文件夹(例如,仅数据集文件夹).我该如何实现?

I want a particular folder in Google drive to to be mounted (for example just the dataset folder). How can I achieve that?

推荐答案

无法安装子文件夹,只能安装顶级Drive. 您可以将Drive安装在一些偏僻的地方,然后将您想要的文件夹符号链接到更中央的位置,例如:

It's not possible to mount a subfolder, only top-level Drive. You can mount Drive in some out-of-the-way place and then symlink the folder you want someplace more central, e.g.:

from google.colab import drive
drive.mount('/gdrive')
!ln -s "/gdrive/My Drive/theFolder" "/content/theFolder"

这篇关于Google Colab:如何挂载特定文件夹而不是挂载根文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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