DEV Community

Cover image for Remote Upload in Google Drive
mohammed hossein mazandaranian
mohammed hossein mazandaranian

Posted on

Remote Upload in Google Drive

This tutorial also has been written in Persian language:
https://vrgl.ir/8Lghf

Remote upload enables you to upload files and programs from any URL to your cloud.
Hopefully we have this feature in Google Drive, but Google Drive doesn't provide this directly to us and we must use Google Colab to achieve it.by the way i made video for this tutorial, you can watch it if you wish.

ok let's start it.
first things first sign into google colab (same as gmail). create a new notebook, now we must mount out google drive in colab, so write this code and run it:

from google.colab import drive
drive.mount('/content/drive')

when you run above code, it gives you a link, click on it and give it access to your account, copy the api code and paste it in the field then hit enter.
Remote upload in google drive

now create new field and write this code:
!wget -P /content/drive/MyDrive/newFolder/

the address in front of -P is path you want your file saved there, so you can change whatever after /MyDrive/ path.

now in front of the code, write your file's url you want to download, here i want to download a mp3 file but you can download pdfs, videos and etc...
!wget -P /content/drive/MyDrive/newFolder/ https://www.bensound.com/bensound-music/bensound-hey.mp3

now run it, you can see the result:

Remote upload in google drive

now if you go to your google drive, you can see that your file is downloaded.

Remote upload in google drive

Top comments (0)