How to upload to Dropbox and overwrite a file Using CURL

0 votes

I'm a small time admin and would say entry level to Linux. I am trying to use CURL to upload to Dropbox a small backup sqlitedb and have had success for the first upload, however, I am trying to accomplish uploading a file to Dropbox every 30 minutes and overwriting the current file in DROPBOX with the new file from my Linux server (as a jerry-rigged offsite backup of my Teamspeak database)

This is the code I have so far :

curl -X PUT https://content.dropboxapi.com/2/files/upload \

--header "Authorization: Bearer <dropbox code here>" \

--header "Dropbox-API-Arg: {\"path\": \"/home/ec2-user/ts3server.sqlitedb.bz2\"}" \

--header "Content-Type: application/octet-stream" \

--data-binary ts3server.sqlitedb.bz2

After running that code once, it doesn't OVERRIDE the current file in my Dropbox account with the updated file. Any help is appreciated

Aug 8, 2018 in AWS by bug_seeker
• 14,960 points
340 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You need to use mode with parameter overwrite. The default is add.

Add - Do not overwrite an existing file if there is a conflict. The autorename strategy is to append a number to the file name. For example, "document.txt" might become "document (2).txt".

overwrite - Always overwrite the existing file. The autorename strategy is the same as it is for add.

Reference: /upload

curl -X POST https://content.dropboxapi.com/2/files/upload \

   --header "Authorization: Bearer " \

   --header "Dropbox-API-Arg: {\"path\": \"/Homework/math/Matrices.txt\",\"mode\": \"overwrite\",\"autorename\": true,\"mute\": false}" \

   --header "Content-Type: application/octet-stream" \

   --data-binary @local_file.txt

answered Aug 8, 2018 by Priyaj
• 56,100 points

Related Questions In AWS

0 votes
1 answer

How to upload a file to Amazon S3 without passing it my server?

This article pretty much explains the entire ...READ MORE

answered Aug 14, 2018 in AWS by Archana
• 3,770 points
34 views
0 votes
1 answer

How to skip headers when reading a CSV file in S3 and creating a table in AWS Athena?

This is a known deficiency. The best ...READ MORE

answered Sep 4, 2018 in AWS by Archana
• 3,770 points
472 views
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.