Table of Contents
A long time ago, I had occasion to WGET files from WeTransfer to a server after being sent a large file from a client, and being located somewhere with poor broadband.
This happens to us less regularly now, but sometimes you maybe will find yourself in a situation where you want to get a file from Google Drive onto your server, instead of downloading and then uploading the same file – i.e. take a backup straight to your new server, or similar.
Is my file big or small?
The first thing to get your head around is this – for the purposes of the below description, you’ll need to check if your file is big or small.
Small = under 100MB
Big = Over 100MB
As we’re usually talking about large zipped up or gzipped backup files, we’re almost always dealing with Big, here, but your needs may differ. If you use the small file WGET on a large file (of over 100 MB) you’ll find you get a zip file, but it’s empty… not good.
The Wget process
The following steps apply whether you have a large or a small file:
- Select the file in Google Drive with right click
- Click “Share” – you’ll see a modal open up
- Click “Advanced” in the bottom right
- Next to “Who has access” press “change”
- Select “ON – Public on the web” and hit “save”
- This will reveal a link for sharing – copy this full link, and paste into a text editor
- You’ll need the part after “https://drive.google.com/file/d/” and before “/view?usp=sharing” for later. This is what we will call “FILE_ID” below
- Use the wget command from below, based on your file size, replacing your relevant data for FILE_ID and FILE_NAME
WGET Command For Small (under 100MB Files)
WGET Command For Large (over 100MB Files)
You should replace FILE_NAME with the name of the zip (or other) file you’d like to call it when it arrives – for example “somesitebackup.zip” or whatever.
Please leave a comment at the bottom if this worked for you, or if you had troubles – there may be some changes to the system as time proceeds. Note this is tested and working as of 7 Jan 2020.