Skip to content

Instantly share code, notes, and snippets.

@kucukkanat
Created October 10, 2021 16:00
Show Gist options
  • Save kucukkanat/be01059649f54ea5c2d575719f254571 to your computer and use it in GitHub Desktop.
Save kucukkanat/be01059649f54ea5c2d575719f254571 to your computer and use it in GitHub Desktop.
Large file downloader from google drive
#!/usr/bin/env sh
export fileid=$1
export filename=$2
TEMP_CONFIRM_FILE=confirm.txt
TEMP_COOKIE_FILE=TEMP_COOKIE_FILE
## WGET ##
wget --save-cookies TEMP_COOKIE_FILE 'https://docs.google.com/uc?export=download&id='$fileid -O- \
| sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1/p' > ${TEMP_CONFIRM_FILE}
wget --load-cookies TEMP_COOKIE_FILE -O $filename \
'https://docs.google.com/uc?export=download&id='$fileid'&confirm='$(<${TEMP_CONFIRM_FILE})
rm ${TEMP_CONFIRM_FILE}
rm ${TEMP_COOKIE_FILE}
# First make executable:
# chmod +x gdown
# Then run :
# ./gdown google_drive_file_id filename_to_download
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment