Copy shared folder from Google Drive

Adding a shared file to your Google drive is easy, adding even 2,3..10 files is fine, you just right click it and add it to “my drive” , but when you have a shared folder with multiple folders inside that need to be hard copied to your drive then you can hit a wall.

First thought is to download and re upload again to your drive, but that is going to cost you time and bandwidth depending on the size you are planning to download/upload.

But there is one easy workaround using Google Colab, so let’s start.

Login to your Google Drive account, make a shortcut from the shared folder to your drive. Search for Google Colab and create New Notebook. In the code tab add the following lines:

from google.colab import drive

Press the little play button on the side of the code block and the code will return a link.

Follow the link, give permission to Google colab to use your drive and at the end of the link there will be long authorization code waiting for you. Copy the code and paste it in to the blank space where is needed. On the side you will find the Files button for easier navigation in your gdrive.

Next add a new code block. In this block we are going to find the root of the “folder” that we need to copy. For the sake of this presentation I’m going to use an example from my drive.

I need to copy shared folder Cisco IOS Updated to a folder I created called Drive.

In the new block that you created add the following line:

%cd /gdrive/My Drive/SHARED_FOLDER

This will return a value for the root of the shared folder. As shown in the picture copy that path and open a new code block and type:


Do not forget the semi columns and the dot included in the code. And at the end click the play button and let the magic begin.