Last Updated on 2021-10-12 by Clay
Google Drive is a very convenient tool and everyone should be familiar with it. Before recording how to use wget command to download files from Google Drive, I briefly introduce it.
Google Drive is an online storage space provided by Google. We can easily upload our files on the Internet and if it is not for our permission, other people can’t download the files we upload.
Since the files are uploaded by ourselves, we can also download them at any time, just log in to our Google account.
It should be noted that the free account only has a capacity of 15GB, and you need to pay if you want to get more space. (there are many e-mail with unlimited capacity in many schools)
Next I will enter the topic: I will record how to use the wget
command in Linux to download files from Google Drive.
It’s a very convenient function.
For example, today we put the files that we want to share with others on Google Drive and we just need to write down a wget
command as a shell script file, we can easily pass the lightweight shell script to others, and it was downloaded by others.
Use wget command to download files from Google Drive
First, we upload a test file we want to share with others on Google Drive.
And then we need to set the sharing permission, right-click on the file you want to share and select Share.
Then select the permission as Anyone on the internet can find and view.
After setting it up, we can finally let everyone download it. But before using wget
, we need to find the download URL.
Enter this link, this link URL is not yet a download URL, just a place where you can view the file.
Click the icon of the download arrow.
The website that pops up, the URL above it is the real download URL. The way to distinguish is very simple, it will end with download.
So, what we have to do next is simple. Open our terminal:
wget "https://drive.google.com/u/1/uc?id=1rt0-DRWWNb18Y2RchhAgx3y2ig2fsB7v&export=download" -O "test.png"
-O test.png
refers to naming the file we downloaded test.png, and remember that the download URL must be enclosed in double quotes.
This is a success. However, if you want to share a large number of files at once, it is recommended to use compressed files when uploading.
Reference
- https://gist.github.com/iamtekeste/3cdfd0366ebfd2c0d805
- https://clay-atlas.com/blog/2019/11/25/linux-chinese-command-wget-note/
Thanks a lot!
There is only one problem:
This method does not work for zip files.
It is possible to download an entire directory instead of one single file?
worked for zip file just fine
Pingback: Sync or download from google drive on debian tinkerbo - Sync-Download