Export multiple drafts as individual text files

I would suggest a script for this - to be executed as a Drafts action. Something along the lines of:

let fmCloud = FileManager.createCloud();
let yourFolder = 'YOUR_FOLDER';
fmCloud.createDirectory(yourFolder, "/");

let draftsGroup = Draft.query(YOUR_QUERY_HERE);
draftsGroup.forEach(function(myDraft) {
    fmCloud.writeString(myDraft.processTemplate('safe_title') + '.md', myDraft.content);
});

You’ll need to define the query - Redirecting…, and specify your folder. This saves to iCloud.

I’ve not had time to test my code, but it should hopefully point you in the right direction.


Alternatively, press and hold on the select button on iOS, and then execute one action on all of the selected drafts (every draft in your current workspace view will be selected). In hindsight that’s probably easier than the code I thought up :laughing:

2 Likes