unixcurlwget

Download Google Drive File to Ubuntu Terminal


I am trying to download the files in the following link via wget:

Google landmark competitions files

I have tried the solutions proposed in the following answers but have been unable to get it to work.

  1. wget/curl large file from google drive
  2. Downloading zip folder/file from google drive from shared with me folder
  3. wget/curl large file from google drive
  4. Using Wget on a google drive file
  5. Download file from Google Drive via HTTP GET request
  6. wget not working for shared files in Google drive

It continues to download a file that ranges in size from 0K to 3.1K depending on the answer but none of them the .zip files.

What am I doing incorrectly?


Solution

  • You can simply use this to download the files from google drive with wget

    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
    

    So the two files which you are looking for can be download as follows:

    >> 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=1J5QX6PflSnmXr428i7rWi0dAz80SOzqN' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1J5QX6PflSnmXr428i7rWi0dAz80SOzqN" -O test.zip && rm -rf /tmp/cookies.txt
    
    >> 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=1rO1xQzMUNxNobKNDdofgW5VihQkeW3j2' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1rO1xQzMUNxNobKNDdofgW5VihQkeW3j2" -O train.zip && rm -rf /tmp/cookies.txt