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
Related Articles:
- 2017/01/02 Trello – backup to your linux machine
- 2016/07/10 Get your local IP address like pro
- 2010/05/27 Checking the links to your site (from affiliates) using cron and bash script.
- 2019/06/03 Split pcap to multiple files based on number of packets
- 2019/05/27 libvirt- Create virtual machine with text console only interface
Authored By Amit Agarwal
Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.