I studied some ways of loading data to Colaboratory from the official notebook.
But it only connects the colab with Google Drive's "My Drive" folder by the command
drive.mount('/content/gdrive')
Picture for colab directory tree
However, I would like to access Google Drive's "Computers" folder in Colab. Is there some way to do it?
Picture for Google Drive web directory tree
Thanks!
From Computers just right click the file and then click Add Shortcut to Drive to the file you would like to open in Colab. This will create a shortcut of that file to Drive. Now when you modify the file there(gdrive) it will automatically be updated on Computers as well. See image below.
Here is a hack that worked for me. You will need two Google accounts: let's call the one with which you're currently mounting to "Computers" from your local drive A
, and the one in which you want to run the notebook B
.
Using account A
, ensure that your files are correctly mounted and visible under "Computers" in your Drive's directory structure.
Turn on link sharing for this directory.
Basically, you now need to share this link with yourself. Log into account B
and visit the link; doing so should land you in the "Shared with me" area of Drive, where you should see your directory.
Drag and drop the directory onto the "My Drive" area in the filetree on the left. This will add the shared directory to the Drive of account B
(i.e. no longer in a "Computers" directory, but now in a "My Drive" directory).
In Colab using account B
, mount your Drive as usual. You should now be able to access your files under "My Drive" of account B
, shared with yourself via account A
.
From what I can tell, sharing the directory is the only workaround that can actually move the whole directory from a "Computers" area to a "My Drive" one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With