Copy files from a mounted Google Drive to a local Google Colab session
Asked Answered
M

2

7

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.

Megalith answered 2/5, 2021 at 18:46 Comment(0)
M
6

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

Megalith answered 2/5, 2021 at 19:49 Comment(0)
D
0

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'

Deland answered 29/6, 2022 at 14:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.