I am working in a Google Colab notebook. I would like to get this notebook's Google Drive details - like a Python __file__ equivalent - so I can get its folder.
Is there a way that I can get the current notebook's Google Drive ID (and other metadata) programmatically so I can get its parent?
hi I'm using drive to interact with drive at low level, you can install it in colab easily:
!wget https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz
!tar -C /usr/local -xzf go1.14.2.linux-amd64.tar.gz
import os
os.environ['PATH'] += ":/usr/local/go/bin"
!go get -u github.com/odeke-em/drive/cmd/drive
os.environ['PATH'] += ":/root/go/bin"
and than you can manipulate your drive:
!drive init
!drive index -no-prompt -quiet
!drive pull -directories -depth 4 -quiet -no-prompt -fix-clashes
it works both with file id and names and cover most usecase with drive.
it have an issue with the printing so add the options -quiet -no-prompt to most of the commands.
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