Skip to content

Instantly share code, notes, and snippets.

@J7mbo
Created February 11, 2019 12:52
Show Gist options
  • Save J7mbo/6951e388461b895c241e5757f8408209 to your computer and use it in GitHub Desktop.
Save J7mbo/6951e388461b895c241e5757f8408209 to your computer and use it in GitHub Desktop.
Download Google Drive file with wget / curl / bash
#!/bin/bash
fileid="$1"
filename="$2"
curl -c ./cookie -s -L "https://drive.google.com/uc?export=download&id=${fileid}" > /dev/null
curl -Lb ./cookie "https://drive.google.com/uc?export=download&confirm=`awk '/download/ {print $NF}' ./cookie`&id=${fileid}" -o "${filename}"
# USAGE: sh gdrive.sh "<FILE ID (FROM URL) GOES HERE>" "<FILE NAME (FROM TOP LEFT OF GDRIVE PAGE) GOES HERE>"
# Example: sh gdrive.sh "1zJ_dLqrJwU5QYHSJDKFLnDC3LSJD" "The Name Of My File.zip"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment