Google Drive Folder Downloader, Rust CLI
Downloading a complete folder from google drive triggers creation of an archive of the folder first, which takes ages. So, this cli tool can be used to download a complete folder one file at a time without creating an archive.
This is rust implementation of the gdown project which is written in Typescript.
cargo run
Create a new project in google cloud console, enable the google drive api for your google cloud project.
Now create a service account under credentials section. For this service account, create and download a new json key, name it credentials.json
and put it in the root directory.
Make sure that the drive scope are as follows:
- https://www.googleapis.com/auth/drive.metadata.readonly (View metadata for files in your Drive.)
- https://www.googleapis.com/auth/drive.readonly (View and download all your Drive files.)
Just put the credentials.json
file in the project root and the bearer token will be automatically fetched from the google auth server, and it will be used for further requests.
After that add the google drive file id you want to download into the file_id
variable in main.rs
file. Then you can run the application to download the file.
- connect to google drive api
- auth using service account
- auth using oauth
- get file details from file id
- download a file
- get file list from folder drive id
- download all files in a folder
- download a folder recursively
- create a cli application
- run on separate threads