sishida21
3/5/2019 - 3:11 AM

Shell script for downloading file from Google Drive.

Shell script for downloading file from Google Drive.

#!/bin/bash
# Description:
#   * Download big size file from Google Drive. To use, specify FILE_ID and OUTPUT.
#   * This script is based on the following link. [https://qiita.com/namakemono/items/c963e75e0af3f7eed732]

FILE_ID="FILE ID"
OUTPUT="OUTPUT FILE NAME"
curl -sc /tmp/cookie "https://drive.google.com/uc?export=download&id=${FILE_ID}" > /dev/null
CODE="$(awk '/_warning_/ {print $NF}' /tmp/cookie)"
curl -Lb /tmp/cookie "https://drive.google.com/uc?export=download&confirm=${CODE}&id=${FILE_ID}" -o ${OUTPUT}