Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Script to download files from Google Drive using Bash
#!/usr/bin/env bash
# gdrive_download
# script to download Google Drive files from command line
# not guaranteed to work indefinitely
# taken from Stack Overflow answer:
# match more than 26 word characters
ggID=$(echo "$gURL" | egrep -o '(\w|-){26,}')
curl -sc /tmp/gcokie "${ggURL}&id=${ggID}" >/dev/null
getcode="$(awk '/_warning_/ {print $NF}' /tmp/gcokie)"
cmd='curl --insecure -C - -LOJb /tmp/gcokie "${ggURL}&confirm=${getcode}&id=${ggID}"'
echo -e "Downloading from "$gURL"...\n"
eval $cmd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment