Created
September 10, 2020 01:50
-
-
Save ikurni/888b87702074ae6ceb04f9f36249269f to your computer and use it in GitHub Desktop.
Use wget to download file from Google Drive
This file contains hidden or 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
# First need to create share link from the file, and get the FILE ID from the sharing URL, example : | |
# https://drive.google.com/file/d/1xlsJtCx7EJXoxGn5SjCUIQ0DGJHsDs61/view?usp=sharing, then the FILE ID will be 1xlsJtCx7EJXoxGn5SjCUIQ0DGJHsDs61 | |
# Run below command to download file, replace FILEID and FILENAME | |
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment