How to download large file from google drive from terminal? (gdown doesn't work)
Asked Answered
W

1

7

This is the extension to this question. All the solution on that post I tired doesn't work for now, unfortunately, since I don't have enough reputation to comment on that post, I can only make a new post about it.

The question is how to download large file using only terminal. An example large file is this

I think the most recent solution is using gdown. Since the id for the file above is 1Vq_UO-T9345uYs8a7zloukGfhDXSDd2A, I tried:

gdown --id 1Vq_UO-T9345uYs8a7zloukGfhDXSDd2A

and I received error message:

        Too many users have viewed or downloaded this file recently. Please
        try accessing the file again later. If the file you are trying to
        access is particularly large or is shared with many people, it may
        take up to 24 hours to be able to view or download the file. If you
        still can't access a file after 24 hours, contact your domain
        administrator. 

The most recent solution suggested on this github discussion page also suggest the same error is received when downloading a huge file, >50gb

Whittington answered 15/12, 2020 at 20:1 Comment(3)
(1) this is not a programming question or problem, and is not ontopic now, although many years ago topicality was broader and existing Qs remain (2) this is a restriction at the server (google) side; it doesn't matter what client(s) you use if the server doesn't permit the downloadToile
Thanks for the comment. Could you possibly explain why would the server side allow user to download large file by clicking it on the browser, but not gdown or wget method described in the github post?Whittington
No idea. It's google's system and 'they' decide how to run it. (In scarequotes because an organization doesn't really make decisions, the people in it do, and I don't know which of the many many people at google are responsible for this.)Toile
Z
30

You can try generating an OAuth token

  • Go to OAuth 2.0 Playground https://developers.google.com/oauthplayground/
  • In the Select the Scope box, paste https://www.googleapis.com/auth/drive.readonly
  • Click Authorize APIs and then Exchange authorization code for tokens
  • Copy the Access token
  • Run in terminal
curl -H "Authorization: Bearer ACCESS_TOKEN" https://www.googleapis.com/drive/v3/files/FILE_ID?alt=media -o FILE_NAME 
Zweig answered 15/5, 2021 at 19:17 Comment(5)
I tried this and it works perfectly. It's the only solution that has eradicated the "Too many users..." message for me and allowed me to write a script to bulk download a massive list of files from Google Drive automatically.Vaillancourt
it's working in December 2022!Lombard
In my case, I need to add -C - in case it needs to be resumed: curl -H "Authorization: Bearer ACCESS_TOKEN" -C - https://www.googleapis.com/drive/v3/files/FILE_ID?alt=media -o FILE_NAME. And it works in January 2023!Speakeasy
july 2024 and this still worksMelmela
Is there a convenient way to do this for a folder?Cloakanddagger

© 2022 - 2024 — McMap. All rights reserved.