问题
I am able to mount Google drive using the code below:
from google.colab import drive
drive.mount('/content/drive')
But the above mounts the Root folder enabling all file access within the drive.
I want a particular folder in Google drive to to be mounted (for example just the dataset folder). How can I achieve that?
回答1:
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"
回答2:
Mount at
/content/drive
from google.colab import drive drive.mount('/content/drive')
Change directory using cd command
cd 'drive/My Drive'
来源:https://stackoverflow.com/questions/53183525/google-colab-how-can-i-mount-a-particular-folder-instead-of-mounting-root-folde