Home > Uncategorized > How to download all files in a Google Drive folder using gdown?

How to download all files in a Google Drive folder using gdown?

April 4, 2024

I found a few guides to use gdown to download files from Google Drive however it will only allow 50 items to be downloaded on that folder.

To fix this issue, we will need to use run a script that will read google drive link line by line then pass down the string to download by using gdown so you can download more than 50 items in one google drive folder

1. select files you want to download on google drive page, you may select multiple files by holding down the control button before clicking for more.

2. go to the top of the menu and choose “Copy links” then you will see a pop-up mentioned the number of links have been copied.

3. save those links into a csv file before import it on excel. choose “data” from top of the menu, you would see a row of links in separate columns.

4. highlight those links, click to another tab and paste it with special option, choose transpose, you would see all link in one column only.

5. modify those links by adding “” at the beginning and back of the links. use this command, ="""" & A1 & """"

6. now you have all the info, we will need to replace those links below.

#!/bin/bash

# Define an array of Google Drive links
links=(
" https://drive.google.com/file/d/1MaY1J_MEFxH8qGt34Qz14rfPBDyvSB8g/view?usp=drive_link"
" https://drive.google.com/file/d/1QYJJue1LcXB6MFs0e_QBs50gKh0vvMcS/view?usp=drive_link"
" https://drive.google.com/file/d/1JUO53pMN5pY9VFe8hxGs1rqKDvc6Fuyn/view?usp=drive_link"
)

# Iterate over each link in the array
for link in "${links[@]}"; do
    # Replace the original gdown command with the link
    command="gdown $link --fuzzy -O /mnt/c/Downloads/"
    
    # Execute the command
    echo "Executing command: $command"
    eval "$command"
done

save the script above by using any name you want, i chose download.sh, then execute it by typing ./download.sh, dont forget to modify the permission of the file by using chmod+x download.sh

you would see your files will be downloaded one by one.

Links –

https://medium.com/@gauravkachariya/download-google-drive-files-on-linux-via-command-line-c0ce06b51dba

https://github.com/wkentaro/gdown

To download all files less than 50 items in a folder, you may use this command.

gdown https://drive.google.com/drive/folders/1cjxMjQJYPjnqEeREzfM4IywRlf4mzzYG -O /mnt/c/Downloads/ --folder --remaining-ok

It will starts to download all files in the folder but limited to 50 items only.

Happy downloading!

Categories: Uncategorized Tags: , , ,