Skip to content

Instantly share code, notes, and snippets.

@ogtfaber
Last active January 19, 2020 00:28
Show Gist options
  • Save ogtfaber/1efa6a367ff86a87ef2c92bc0315d624 to your computer and use it in GitHub Desktop.
Save ogtfaber/1efa6a367ff86a87ef2c92bc0315d624 to your computer and use it in GitHub Desktop.
Copy Google Drive file to Google Storage account (using Colab)
# Mount drive
from google.colab import drive
drive.mount('/content/drive')
# Mount storage account
project_id = 'rm-pulse'
from google.colab import auth
auth.authenticate_user()
!gcloud config set project {project_id}
# Copy file
bucket_name = 'your-bucket-name'
drive_directory = '/content/drive/.../...'
drive_file = 'your-drive-file'
bucket_directory = 'your-destination-directory'
!gsutil -mq cp {drive_directory}/{drive_file} gs://{bucket_name}/{bucket_directory}/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment