I want to download the file that is viewable at this address to a linux remote:
https://drive.google.com/file/d/0Bz7KyqmuGsilT0J5dmRCM0ROVHc/view?usp=sharing
I'm hoping I can do this with wget
.
I tried
wget https://drive.google.com/file/d/0Bz7KyqmuGsilT0J5dmRCM0ROVHc/vgg16_weights.h5
and the response was a 404.
Is it possible to wget
a google drive file? If so, what is the path to provide? If not, are there any alternatives (bash or other) so I can avoid downloading the file to my local and transferring it to the remote?
Insert your file ID into this URL (https://drive.google.com/uc?export=download&id=
), then surround the URL with quotes so that Bash doesn't misinterpret the &
, like so:
wget "https://drive.google.com/uc?export=download&id=0Bz7KyqmuGsilT0J5dmRCM0ROVHc"
Reference here.
When downloading big files, Google Drive adds a security warning that breaks the script above. In that case, you can download the file using:
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
(Script taken from here)