Syncing to Dropbox

Hi there

I have read Using Dropbox with Drafts but I am not sure how to sync a draft to Dropbox.

I mean I want to read the draft from a path on Dropbox and then after editing I want to write it back to the same path.

What’s the easiest way to do this?

Thanks for any pointers!

Post v4, Drafts uses iCloud for sync and so can’t auto-sync to files in Dropbox.

You can create actions that would let you read in a file from Dropbox and save back to it. This would be manually triggered. That refers back to the details in the post you linked to above.

I wrote a couple of actions to semi-automate the process of moving drafts to and from Dropbox:

It’s flexible in that it lets you save the draft anywhere in Dropbox, but it’s limiting in that you have to include the path to the file somewhere in the draft.

1 Like

If you always keep a single draft per file, you could consider moving the path out into an index (e.g. as a JSON file) where you could match a draft UUID and a file path. If it isn’t a persistent 1-2-1 match, you would probably also need to include an initial existence in index & drafts/ Dropbox check, and overwrite the index value if necessary.

More complicated to maintain, but does keep your files clean, which can be an issue if they are config files, or if there’s a variation in the formats, gets around the approach that’s commonly used of putting the path on the first line which then makes it the title, etc.

Thanks Dr. Drang! These scripts look great! I am checking it out!

Hi sylumer, interesting idea - not necessarily what I need, but I can see the point.