Skip to content

Instantly share code, notes, and snippets.

View kevinbird61's full-sized avatar
:octocat:

Kevin Cyu kevinbird61

:octocat:
View GitHub Profile
@kevinbird61
kevinbird61 / download.sh
Created May 17, 2019 11:51
Download from remote host.
#!/bin/bash
# Script for downloading file from remote server.
# Usage: ./download.sh gdrive <FILE_ID> <FILENAME>
function gdrive()
{
CONFIRM=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "https://docs.google.com/uc?export=download&id=$1" -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$CONFIRM&id=$1" -O $2
rm -rf /tmp/cookies.txt
}