I want to get access to the files in the Google Drive's "Shared with me" directory.
In the Colab python notebook the following commands:
import os from google.colab import drive drive.mount('/content/drive') !ls "/content/drive/My Drive"
work well for "My Drive" directory however
!ls "/content/drive/My Drive"
fails with
FileNotFoundError: [Errno 2] No such file or directory:
I am aware of the fact that I can add the folder to my drive manually and proceed (as mentioned in here), but I would like to have direct access to the shared folders for lets say I might need to automate the work with files that are shared with me real time.
I am also aware that same/similar problem exist with other cloud platforms like "OneDrive".
The questions are:
Using Colab. Colab notebooks are stored in Google Drive, or can be loaded from GitHub. Colab notebooks can be shared just as you would with Google Docs or Sheets. Simply click the Share button at the top right of any Colab notebook, or follow these Google Drive file sharing instructions.
Go to drive.google.com. On the left, click Shared with me. Select the files or folders to which you want to add a shortcut.
Since a Colab notebook is hosted on Google's cloud servers, there's no direct access to files on your local drive (unlike a notebook hosted on your machine) or any other environment by default. However, Colab provides various options to connect to almost any data source you can imagine.
Another work around is go to Google Drive, right click on the folder in question, and then click "Add shortcut to Drive". This will allow you to access the folder from your drive!
RE: Is there a work-around --
Load your shared files in the web UI, right click on the directory of interest, and select 'Add to my Drive'. Then, the folder will appear in /content/drive/My Drive
as you hope.
For context, Drive isn't like a normal filesystem: files and directories can have multiple parents, thereby appearing in both your file list and the original owners.
RE: Will other users have access to Drive files? --
No, the notebook is a distinct object in Drive with distinct Drive permissions.
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