Add files to dropbox with single curl command

2019-07-08 105 words 1 min read

I have been thinking of posting this for sometime now. This is very useful, when you are working on a different Linux box and want to upload a file to dropbox.

 

So, before you run this command, you need to create your auth token in Dropbox developer API page. Once that is done, need to change the 2 parameters in command below. Export your Access token and run the below command.

Here is the command:

tar cvzf /tmp/backup.tgz <folder of your choice>
curl -X POST https://content.dropboxapi.com/2/files/upload \
    --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" \
    --header "Dropbox-API-Arg: {\"path\": \"/<dropbox path>/$(hostname -s)/$NOW.tgz\"}" \
    --header "Content-Type: application/octet-stream" \
    --data-binary @/tmp/backup.tgz

author

Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it