Last active
September 17, 2019 08:20
-
-
Save vithalreddy/ea807b3e7123b5ff2e8b56fbd016027d to your computer and use it in GitHub Desktop.
Shell Script To Download Google Drive Files from terminal
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/bash | |
read -p "Enter File Id: " fileid | |
read -e -p "Enter File Dir: " "path_to_download_dir" dir #replce with your download dir path ~/Downloads | |
cd ~/$dir | |
echo "File will be downloaded in dir: ~/{$dir}" | |
curl -c ./$fileid -s -L "https://drive.google.com/uc?export=download&id=${fileid}" > /dev/null | |
curl -Lb ./$fileid "https://drive.google.com/uc?export=download&confirm=`awk \ | |
'/download/ {print $NF}' \ | |
./$fileid`&id=${fileid}" -O -J -L | |
if [ -f ./$fileid ] ; then | |
rm -rf ./$fileid | |
echo "cookie file deleted successfully" | |
fi | |
echo "File downloaded in dir: ~/{$dir}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To Make Script Exec,
well you can make it by doing as
chmod +x gd.sh
so it will execute when you call it will
./gd.sh