4

I want to write a script to download this folder from Google Drive. The script is aimed for non-expert UNIX users so I don't want to use more than curl or wget.  I've seen solutions with the fileid, but I cannot manage to get the fileid in my case.

Is there anyone that managed to download folders from Google Drive?

Here are the solutions I tried:

Heko
  • 41

3 Answers3

4

The easiest up-to-date solution (2021) I found to download large folders from google drive is gdrive:

http://github.com/prasmussen/gdrive

gdrive download --recursive --skip <file_id>

where <file_id> is the id you get from the folder URL. No need to configure anything, it will already ask you for your credentials and such.

The --skip flag is useful for large folders, since the download might time out at some point. You then rerun the command and --skip will make it act like an rsync.

As of this date, --skip is a relatively new flag and is available if you install gdrive through Go. If your system gdrive doesn't have it, try the same without --skip. Then, if you really need it, install it using go get as described in the github readme page.

rfabbri
  • 141
  • 4
  • 2
    As of March 2022, the binary that is downloadable from github includes the --skip flag – Fred Mar 13 '22 at 22:13
1

I wrote a Python code using the PyDrive library, that can recursively retrieve the sub-folders and files inside a parent folder. Using the ids of the files, I then generated a bash script using wget.

Step 1 I have used the PyDrive library. To use this library, you have to complete the instructions described in this link.

Step 2 Now, create a python script or notebook in the same working directory, where you have saved the “client_secrets.json” file. I have attached the notebook below.

https://gist.github.com/immuntasir/73b8e8eef7e6c9066aaf2432bebf7db0

Step 3 Using scp, copy the “script.sh” to the remote server. scp ~/path/script.sh username@ip:path

Step 4 Login to the remove server, navigate to the path. Then make the script executable using the following command. chmod 777 script.sh Run the script and voila! ./script.sh

I also wrote a tutorial, which can be found here: https://medium.com/@immuntasir/recursively-download-all-the-contents-of-a-google-drive-folder-using-python-wget-and-a-bash-script-d8f2c6b105d5

Hope this helps!

  • This requires the user of the script to enable google drive API and authenticate, for what otherwise doesn't require any authentication through the browser. – ybungalobill Aug 08 '20 at 00:48
-1

Your fileId is on the url adress of your folder, you can simply run

wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME
eltoro
  • 1