Last active
July 2, 2019 13:20
-
-
Save isphus1973/0d1c024e8302058a698f1028c6fb00f6 to your computer and use it in GitHub Desktop.
Small bash script that downloads a Google Drive file with wget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
######Usage####### | |
# ./dgoogle_download.sh FILE_ID OUTPUT_NAME | |
## Remember to chomod +x dgoogle_download.sh | |
#This scrip is based on https://unix.stackexchange.com/questions/136371/how-to-download-a-folder-from-google-drive-using-terminal | |
LINK="https://drive.google.com/uc?export=download&id="$1 | |
CODE="$(wget -q --save-cookies $1.txt --keep-session-cookies --no-check-certificate $LINK -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1/p' )" | |
LINK="https://drive.google.com/uc?export=download&confirm=$CODE&id="$1 | |
wget --load-cookies cookies.txt $LINK -O $2 | |
rm -f $1.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment