简体   繁体   中英

Copy files from a mounted Google Drive to a local Google Colab session

Because of a very large image dataset, datagen.flow_from_directory is extremely slow. Is there a way to copy the "data" folder on my Google drive to the local session in Google Colab? Kind of like uploading a file from my PC to the session, but from Drive.

Found it. After mounting the drive, it's as simple as

!cp -r /content/drive/MyDrive/data /content/data

The first path is the "data" folder on my Google Drive, and the second one is the destination in my current runtime

i hope that this notebook can help you. link to notebook

  • FOLDER_PATH - path of folder you want to copy
  • DESTINATION_PATH - destination of the folder where you want to save the copy

!cp -r '/gdrive/My Drive/FOLDER_PATH' '/gdrive/My Drive/DESTINATION_PATH'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM