In this tutorial, I will share How to Download a File in Google Drive using Command Line Interface, using this script you can download a file without file size limitation, maybe you can use gdown but gdown sometimes still error if you download a big file from Google Drive
Before Download a Big File, Create OAuth Authentication First
This script also same if you don’t configure first, can’t download a big file from Google Drive, so you must create OAuth Credentials first
- Login to Google Developer Console and Create Project first
- Note: If you don’t have project Click on Select Project → New Project
Click to Show Image
|
- Click Hamburger menu on the left → Select API & Services → Select Library
Click to Show Image
- Search for Google Drive API and Enable Google Drive API
Click to Show Image
|
- Click Credentials on left pane and Click + CREATE CREDENTIALS and select OAuth Client ID
Click to Show Image
|
Note: If you face this error, click on CONFIGURE CONSENT SCREEN
Click to Show Image
- Select External and click CREATE
Click to Show Image
- Just fill in the section
- App name *
- User support email
- Email addresses
- Click SAVE AND CONTINUE until Step 4 and Click Publish in the Production section
- Back to Create Credentials
- After select OAuth Client ID
- Application type select Desktop app
- Name fill whatever you want
- Click CREATE
- If success, you will get Client ID and Client Secret, Save it.
Click to Show Image
Download a File From Google Drive
- This script you can find it in Official GitHub Repository
- To install this script, just execute command
|
|
alternatively, you can use the original github url instead of https://drivedl.cf
|
|
- This script installed at
${HOME}/.gdrive-downloader/
- To Download a File from Google Drive (Especially big file) use command
|
|
Click to Show Image
- And you will be asked to put (Only one time), and this config file saved in
${HOME}/.gdl.conf
- Client ID → Fill in the client ID with the one you created earlier
- Client Secret → Fill in the client Secret with the one you created earlier
- Refresh Token → Just blank and hit enter
- And the link will appear, click on that link to get authorization code
Click to Show Image
- Login with your Google Account
Click to Show Image
- In this case Warning like this is normal, because app we create earlier is not verified by Google, so just click show advanced and click Go to yourappname (unsafe)
Click to Show Image
- Click Allow
Click to Show Image
- Click Allow Again
Click to Show Image
- And you get authorization code copy and paste to terminal console
Click to Show Image
- Login with your Google Account
- And file will be downloaded immediately
Click to Show Image
If you want to download a big file again, just use command gdl -o driveID
and will not be asked to enter the auth code.
For Documentation, you can see in GitHub Repository
Special Thanks to: Akianonymus for making a great script!