Downloading shared Dropbox files to a remote server via command line (CLI) and cURL

On occasions I have found it very handy or even necessary to download large archive files from a Dropbox share to a remote server. Rather than downloading it to my local machine and then uploading it back to the server (via FTP for example). It can be directly downloaded to the target machine through the terminal.

Simply make sure the share url has dl=1 appended as a query parameter:

curl -L -o archive-name.zip https://www.dropbox.com/sh/r4nd0mURL?dl=1

-L is telling cURL to retry the request to the specified redirect location, if a location header is received from a 3XX response. For example if Dropbox gives a HTTP 3XX redirect response directing to a temporary download link, cURL will re-try the request using the link. Basically it will follow the redirect if there is one.

-o is simply for the output filename of where you want to store the response.

Resources: