Download a file from google drive using wget

efbbrown picture efbbrown · May 26, 2016 · Viewed 76.7k times · Source

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?

Answer

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.