Created
January 11, 2022 06:33
-
-
Save ntdat017/e6564707c8e77b2ebeb4a0c3d6d5af1d to your computer and use it in GitHub Desktop.
script to google drive downloading
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
#!/usr/bin/env bash | |
drive_download() { | |
if [[ -f "$3/$2" ]]; then | |
echo "$2 already existed" | |
return | |
fi | |
echo "$2 not found, downloading..." | |
mkdir -p "$3" | |
curl -c ./cookie -s -L "https://drive.google.com/uc?export=download&id=$1" > /dev/null | |
curl -Lb ./cookie "https://drive.google.com/uc?export=download&confirm=`awk '/download/ {print $NF}' ./cookie`&id=$1" -o "$3/$2" | |
rm -rf ./cookie | |
echo "$2 is downloaded succesfully" | |
} | |
drive_download "11YIF6MssAfT0-Lah11SgpsOThyBkmyhd" "sample_text.txt" "./" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment