Google Colab: How can I mount a particular folder instead of mounting root folder?

13,798

Solution 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"

Solution 2

If you have confidential files, you can create a new google login for collab studies, at least until google creates a way to mount the folder and not the entire driver.

Share:
13,798

Related videos on Youtube

PrakashO
Author by

PrakashO

Updated on October 09, 2022

Comments

  • PrakashO
    PrakashO over 1 year

    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?

  • Hendy Irawan
    Hendy Irawan over 4 years
    really sad :'( was hoping for a solution