Transfer data in/out of Colab

Script
Transfer data from from Google Drive, GCS and other external sources in/out of Colab
Author

Rafa Sanchez

Published

February 1, 2020

Transfer files from Google Drive to GCS within Colab

The following script shows how to transfer files from Google Drive to GCS when using Colab:


from google.colab import drive
drive.mount('/content/drive')
project_id = <YOUR_PROJECT_ID>
!gcloud config set project $project_id
!gsutil ls
!gcloud auth login
!gsutil ls
!gsutil -m cp -r /content/drive/My\ Drive/a/06/* gs://BUCKET_NAME/06/