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

Updated Tested on curl and wget on macOS, Oct 2026 7 min read

Quick answer

To download a large Google Drive file with curl or wget, share it as Anyone with the link, copy its file ID, and request https://drive.usercontent.google.com/download?id=FILE_ID&export=download&confirm=t. The confirm=t parameter skips the virus-scan warning page. Private files need the Drive API with an OAuth access token.

Google Drive moved its download endpoint to drive.usercontent.google.com. Older drive.google.com/uc?…&confirm=t commands now redirect and drop confirm=t, so they save a “Virus scan warning” HTML page instead of your file.

Methods in this guide:

Why large files fail to download

Use this section if your download finishes instantly and the file is only a few KB.

For files that are too large for Google to virus-scan, Drive shows a confirmation page instead of starting the download. A browser shows you a Download anyway button. curl and wget can’t click it, so they save the HTML page.

Google doesn’t publish the exact size at which this starts. Treat any file over roughly 100 MB as likely to need the steps below; small files often download without them.

Note: On 19 October 2026 we checked the old form, https://drive.google.com/uc?export=download&id=FILE_ID&confirm=t. It returned a 303 redirect to drive.usercontent.google.com without confirm=t, and the page that came back was titled “Google Drive - Virus scan warning”.

Prerequisites: build the direct download URL

Use this before any curl, wget or gdown command.

  1. In Google Drive, right-click the file and choose Share. Under General access, select Anyone with the link.
  2. Copy the link. The file ID is the part between /d/ and /view.
    • In https://drive.google.com/file/d/19eYCYiVuJ3CgYwfAeYB2tG_RfdoJPAHZ/view?usp=sharing, the ID is 19eYCYiVuJ3CgYwfAeYB2tG_RfdoJPAHZ.
    • If you can’t find the file, here’s how to find the file’s folder in Drive.
  3. Put the ID into this URL:
https://drive.usercontent.google.com/download?id=FILE_ID&export=download&confirm=t

Result: A URL that returns the file itself. With our 100 MB sample PDF it returned application/octet-stream with the original filename in the Content-Disposition header.

If you need direct links for many files at once, this video shows how to generate them in bulk:

Downloading large files using curl

Use this when you want a single command that works in scripts, CI jobs and servers. curl ships with macOS, current Windows 10 and 11 builds, and most Linux distributions.

  1. Open a terminal.
  2. Run the command with your file ID:
Terminal window
curl -L -o largefile.pdf "https://drive.usercontent.google.com/download?id=19eYCYiVuJ3CgYwfAeYB2tG_RfdoJPAHZ&export=download&confirm=t"
  1. To keep Google’s filename instead of choosing one, replace -o largefile.pdf with -OJ.

What the options do:

  • -L follows redirects.
  • -o largefile.pdf writes the download to that file.
  • -OJ saves the file using the name in the Content-Disposition header.
  • Quote the URL, because & has a special meaning in the shell.

Result: curl shows a progress meter and saves the file. Check it with file largefile.pdf; if it says “HTML document”, the URL is wrong or the file isn’t public.

Tip: If the connection drops, run the same command with -C - added. curl resumes from the end of the partial file.

Downloading large files using wget

Use this when wget is already part of your tooling, for example in cron jobs or minimal Linux images. See the GNU Wget manual for every option.

  1. Open a terminal.
  2. Run:
Terminal window
wget --content-disposition "https://drive.usercontent.google.com/download?id=19eYCYiVuJ3CgYwfAeYB2tG_RfdoJPAHZ&export=download&confirm=t"

What the options do:

  • --content-disposition saves the file with the name Google sends (for our sample, sampledocs-100mb-pdf-file.pdf).
  • Use -O largefile.pdf instead if you want to set the name yourself.
  • Add -c to resume an interrupted download.

Result: wget prints the response, the file length and a progress bar, then saves the file in the current folder.

Downloading large files using gdown

Use this when you work in Python, need a whole folder, or want to export a Google Doc or Sheet. gdown handles the confirmation page for you, so you don’t need to build the usercontent URL.

  1. Install it (current versions need Python 3.10 or later):
Terminal window
pip install gdown
  1. Download by file ID or by the share link:
Terminal window
gdown 19eYCYiVuJ3CgYwfAeYB2tG_RfdoJPAHZ
gdown "https://drive.google.com/file/d/19eYCYiVuJ3CgYwfAeYB2tG_RfdoJPAHZ/view?usp=sharing"
  1. Download a public folder, or resume a partial file:
Terminal window
gdown https://drive.google.com/drive/folders/FOLDER_ID -O ./my-folder
gdown 19eYCYiVuJ3CgYwfAeYB2tG_RfdoJPAHZ --continue

In a Python script:

import gdown
gdown.download(id="19eYCYiVuJ3CgYwfAeYB2tG_RfdoJPAHZ", output="largefile.pdf")

Result: gdown prints the source URL and a progress bar, then saves the file.

Note: A bare folder ID needs --folder, because file IDs and folder IDs look the same. Folder URLs are detected automatically.

Downloading Google Docs and Sheets files

Use this when the file is a native Google Doc, Sheet or Slides file rather than an uploaded PDF or ZIP. These files have no binary to download, so you request an export instead.

  • Public Google Doc as PDF: curl -L -o doc.pdf "https://docs.google.com/document/d/DOC_ID/export?format=pdf"
  • With gdown: pass the Docs, Sheets or Slides URL. Docs export to .docx by default; add --format pdf for a PDF.
  • Private files: use the Drive API’s files.export method. Google caps exported content at 10 MB.

If you only need one document, it’s often quicker to export a Google Doc as a PDF from the Docs menu.

Downloading private files using the Google Drive API

Use this when the file isn’t shared publicly, or you need downloads inside an application. The Drive API download guide documents every option.

Quick curl call with an access token

If you already have an OAuth access token with a Drive scope, curl can call the API directly:

Terminal window
curl -L "https://www.googleapis.com/drive/v3/files/FILE_ID?alt=media" \
--header "Authorization: Bearer ACCESS_TOKEN" \
--output largefile.pdf

Python script with OAuth

  1. In the Google Cloud Console, create or select a project.
  2. Go to APIs & Services → Library, search for Google Drive API and click Enable.
  3. Go to Google Auth platform → Branding and set up the OAuth consent screen.
  4. Go to Google Auth platform → Clients → Create Client, choose Desktop app, and save the downloaded JSON file as credentials.json. Google’s Drive API Python quickstart walks through these screens.
  5. Install the client libraries:
Terminal window
pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib
  1. Save and run this script:
import os
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient.discovery import build
from googleapiclient.http import MediaIoBaseDownload
SCOPES = ["https://www.googleapis.com/auth/drive.readonly"]
def get_service():
creds = None
if os.path.exists("token.json"):
creds = Credentials.from_authorized_user_file("token.json", SCOPES)
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
flow = InstalledAppFlow.from_client_secrets_file("credentials.json", SCOPES)
creds = flow.run_local_server(port=0)
with open("token.json", "w") as token:
token.write(creds.to_json())
return build("drive", "v3", credentials=creds)
def download_file(service, file_id, destination):
request = service.files().get_media(fileId=file_id)
with open(destination, "wb") as fh:
downloader = MediaIoBaseDownload(fh, request)
done = False
while not done:
status, done = downloader.next_chunk()
print(f"Download {int(status.progress() * 100)}%")
if __name__ == "__main__":
service = get_service()
download_file(service, "FILE_ID", "largefile.pdf")
print("Saved largefile.pdf")

Result: The first run opens a browser so you can sign in and allow access. It then saves token.json, so later runs download without a prompt.

Note: get_media works for uploaded files such as PDFs, ZIPs and videos. For Google Docs, Sheets and Slides, use files().export_media(fileId=..., mimeType="application/pdf") instead.

Comparing the download methods

MethodBest forWorks on
curl + usercontent URLOne-line downloads in scripts and serversPublic files; macOS, Windows, Linux
wget + usercontent URLCron jobs and minimal Linux imagesPublic files; mainly Linux and macOS
gdownPython projects, folders, Docs/Sheets exportsPublic files; anywhere Python 3.10+ runs
Drive API (OAuth)Private files and applicationsAny file you can access; any language with a client library

All four can resume: curl -C -, wget -c, gdown --continue, and the API’s chunked or Range downloads.

Automating downloads with a script

Use this when you download the same files often, such as datasets or build artifacts.

#!/bin/bash
# Download a public Google Drive file with curl
FILE_ID="19eYCYiVuJ3CgYwfAeYB2tG_RfdoJPAHZ"
FILE_NAME="largefile.pdf"
curl -L -C - -o "${FILE_NAME}" \
"https://drive.usercontent.google.com/download?id=${FILE_ID}&export=download&confirm=t"
if file "${FILE_NAME}" | grep -q HTML; then
echo "Got an HTML page instead of the file. Check sharing and the file ID." >&2
exit 1
fi
echo "Download complete: ${FILE_NAME}"

The final check catches the most common failure: a saved warning or sign-in page.

Troubleshooting common errors

  • The file is a few KB of HTML. You hit the virus-scan page or a sign-in page. Use the usercontent URL with confirm=t, and confirm the file is shared with Anyone with the link.
  • 403 or “access denied”. The file is private, or your organization blocks public sharing. Use the Drive API with an access token.
  • “Too many users have viewed or downloaded this file recently”. The public link hit a temporary limit. Google’s Download a file help page says it usually resets within 24 hours.
  • The download stops partway. Re-run with curl -C - or wget -c to resume.
  • The filename is wrong. Use curl -OJ or wget --content-disposition to keep Google’s name.

Security considerations

Skipping the scan warning means Google hasn’t checked the file for malware.

  • Only download files from people or projects you trust.
  • Scan the file locally before you open or run it.
  • Share public links narrowly, because anyone with the link can download the file.

For more Drive and Docs how-tos, see the Google Docs and Drive guides.

Frequently asked questions

Why does wget or curl download an HTML file instead of my Google Drive file?

You received Google Drive's virus-scan warning page, not the file. Use the drive.usercontent.google.com/download URL with export=download and confirm=t, and follow redirects with curl -L.

Can I download a private Google Drive file with curl?

Only with an OAuth access token. Call https://www.googleapis.com/drive/v3/files/FILE_ID?alt=media with an Authorization: Bearer header, as shown in Google's Drive API download guide.

How do I download a whole Google Drive folder from the command line?

curl and wget can't list a folder. Use gdown with the folder URL (or --folder with a bare folder ID), or use the Drive API to list the folder's files and download each one.

How do I resume a failed Google Drive download?

Run the same command again with curl -C - or wget -c. The usercontent download URL accepts byte ranges, so both tools continue from where the partial file ends.

What does "Too many users have viewed or downloaded this file recently" mean?

The public link hit Google's temporary download limit. Google says it usually resets within 24 hours; if you have access, you can also make a copy in your own Drive and download that.