This is based on the following page.
Is there a way to get the ID of a Google Drive folder from the path using Colab?
Let's say I have a folder on GDrive with the path /content/drive/MyDrive/MyFolder. I know I can access the contents of the folder from Google Colab after mounting Drive. But is it also possible to ...
By writing the following code, you can get a Google Drive folder ID from a path.
# ドライブのマウント
from google.colab import drive
drive.mount('/content/drive')
# koraのインストール
!pip install kora
from kora.xattr import get_id
# 例)マイドライブへのidを取得する
path = "/content/drive/MyDrive"
fid = get_id(path)
print("https://drive.google.com/drive/u/1/folders/{}".format(fid))
You can also try it from the following notebook. I hope you find this helpful.



Comments
…