How to download anything directly to GDrive Quick Guide

PIRATE

Administrator
Feb 27, 2019
3,749
405
83
India
How to download anything directly to GDrive Quick Guide

Step 1:- open colab

Step 2:- Mount Gdrive using this code

from google.colab import drive

Code:
drive.mount(’/content/gdrive’)

Step 3: Once mounted

Copy this code in another cell

import requests

Code:
 file_url = "Replace here with file download url "

r = requests.get(file_url, stream = True) )

with open(“Replace this with path where u want to store it And also add file name with its extension”, “wb”) as file:

Code:
for block in r.iter_content(chunk_size = 1024):

if block: file.write(block)

Step 5: Wait for cell to complete process Done!


Method 2
Step 1:- Mount Gdrive

Step 2:-Copy This code in another cell

Code:-

Code:
!wget “example.com/download.zip” -P “/content/drive/”

Step 3:- Wait for it to get completed

Note
1.In method 2 i have used Font collection as example u can replace it with Any url you want to download from
2.Method 2 will be slower than Method 1
3.You Can also Use this method to download direclty to your team drive
4.You cannot use Zippyshare url to download to team drive using these methods
 
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock