How to Download a Large File From Google Drive Using WGET or CURL – Definitive Guide

Google Drive allows you to store files of any size. While downloading files from Google Drive using Wget or CURL, files with less than 40 mb are downloaded without issues. However, files larger than 40 MB will not be downloaded.

You can download a large file from Google Drive using the wget or curl by appending the confirm=t parameter in the download URL.

This tutorial teaches you how to WGET/CURL a large file from Google Drive.

To download smaller files, you can use the below commands without the confirm=t parameter.

Why Large files are not Downloaded by Default in CURL/WGET

  • The reason for the issue while downloading a large file is due to the Virus scan that happens while downloading any file from Google Drive. Smaller files are scanned and downloaded, but larger files cannot be scanned. Hence, Google Drive prompts the user to confirm if the file can be downloaded without a Virus Scan.
  • If the user clicks Yes, the file will be downloaded, or it will not be downloaded. When the user clicks yes, the download anyway form is posting to the same download URL with the additional parameters. Namely, t, confirm, and uuid. (You can identify this by checking the source code of the “Download confirmation page”.)
  • Hence, using the URL with the confirm=t query parameter will send the confirmation to download the file without virus scanning. And the download will proceed without prompt.

Prerequisite Steps

  1. Share the file and Change the access setting to Anyone with the link
  2. Copy the link, and find the file ID of the file. https://drive.google.com/file/d/19eYCYiVadsfadsfadRfdoJPAHZ/view?usp=sharing
  3. Create a download URL by appending the file id and the confirm=t parameter to the download URL. The URL must look like: https://drive.google.com/uc?export=download&id= 19eYCYiVadsfadsfadRfdoJPAHZ&confirm=t
Download Large file from Google drive using WGET/CURL

Download a Large File from Google Drive using CURL

cURL, short for “Client URL,” is a versatile command-line tool and library designed for transferring data with various network protocols, including HTTP, HTTPS, FTP, FTPS, SCP, SFTP, LDAP, and more. It is also mainly used when downloading files or transferring data using scripts.

The following command shows how to download the large file from Google Drive using CURL.

Command

curl -L 'https://drive.google.com/uc?export=download&id=19eYCYiVuJ3CgYwfAeYB2tG_RfdoJPAHZ&confirm=t' > largepdf.pdf
  • curl – command to denote the curl
  • -L – parameter to specify the download location
  • URL – The URL of the Google Drive file with the confirm=t parameter to download the file without virus scanning.
  • > – Symbol to denote that the content downloaded must be written to a file
  • largepdf.pdf – The file name to which the content must be written to.

When you execute the above command, you’ll see the following output about the download progress.

Output

 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  100M  100  100M    0     0  8833k      0  0:00:11  0:00:11 --:--:-- 14.8M

This is how you can download a large file from Google drive using CURL.

Download a Large File from Google Drive using WGET

The wget is a command-line utility that facilitates downloading files from the internet. It offers a straightforward way to fetch content by simply providing a URL.

With its ease of use and ability to recursively download entire websites, wget is a reliable tool for various tasks, including automated downloads, mirroring websites, and resumable transfers.

Code

The following command shows how to use wget to download large files from Google Drive.

wget --content-disposition 'https://drive.google.com/uc?export=download&id=19eYCYiVuJ3CgYwfAeYB2tG_RfdoJPAHZ&confirm=t'
  • wget – Command to denote the wget utility used for downloading files
  • --content-disposition – Option that tells wget to use the server-specified filename during download
  • URL – The URL of the Google Drive file with the confirm=t parameter to bypass virus scanning

When you execute this command, the file will be downloaded.

Output

HTTP request sent, awaiting response... 200 OK
Length: 105255200 (100M) [application/pdf]
Saving to: 'sampledocs-100mb-pdf-file.pdf.1'

sampledocs-100mb-pd 100%[===================>] 100.38M  11.4MB/s    in 7.9s    

2023-08-09 13:11:57 (12.7 MB/s) - 'sampledocs-100mb-pdf-file.pdf.1' saved [105255200/105255200]

This is how you can download a large file from Google drive using wget.

Download a Large File from Google Drive using GDown Library

The gdown library is a Python tool that simplifies the process of downloading files from Google Drive using their file IDs or shareable links.

It is useful when handling large files, such as datasets or resources hosted on Google Drive, as it automates the authentication process and streamlines the download.

With gdown, you can retrieve content from Google Drive by providing the file ID or link, eliminating the need to navigate complex authorization mechanisms.

Use this when you want to download the file using its ID alone and without generating the download URLs.

Installing gdown

pip install gdown

After installing the gdown library, you can use the following commands to download large files.

Code

gdown 19eYCYiVuJ3CgYwfAeYB2tG_RfdoJPAHZ
  • gdown – Library name
  • file_id – Id of the file in the Google drive

Use the following command to download a file with a URL.

gdown "https://drive.google.com/uc?export=download&id=19eYCYiVuJ3CgYwfAeYB2tG_RfdoJPAHZ"

Output

Downloading...
From (original): https://drive.google.com/uc?id=19eYCYiVuJ3CgYwfAeYB2tG_RfdoJPAHZ
From (redirected): https://drive.google.com/uc?id=19eYCYiVuJ3CgYwfAeYB2tG_RfdoJPAHZ&confirm=t&uuid=53d55d63-2d5f-4f93-abb0-3208466ce11e
To: /Users/vikram/sampledocs-100mb-pdf-file.pdf
100%| 105M/105M [00:07<00:00, 13.2MB/s]

These are the different methods to download large files from Google drive in command line.

Leave a Comment