How to download multiple files from Google Drive using terminal

Sometimes it may be quite annoying to download files from Google Drive folders one by one. To make this task easier one may use terminal and special console tool — gdown

Let’s find out how to download weights available for PyTorch model via shared link (Fig 1.)

Fig 1. Files we want to download

First, you need to install gdown: pip install gdown

Second, open the shared folder via link using your favorite browser and go to developer tools (Unix: ctrl+shift+I, macOS: command+option+I) ▶ console. To obtain the links, type down the following command into your console:

You will see ready-to-use URLs for gdown CLI (Fig 2.)

Fig 2. Links to our files

Finally, open your terminal and use the following command to download all files (don’t forget to replace %LINKS% with string and remove quotation marks):

Moreover, you can use xargs to parallelize and speed up downloading. Just replace gdown $f with echo $f and redirect output to xargs :

That’s it, pretty simple.

Deep Learning Engineer @ Samsung AI Center, Moscow

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store