Bulk exporting multiple drafts as individual text files

As this topic is about exports, I am replying here, not in the “Select all” topic:

I totally understand what you wrote about individual ideas and wishes about an export!

But for a “basic” export (and import) that would fulfil the needs of most, the following would sure be enough:

Getting a selection of drafts out of Draft in a way that they could be restored in Drafts again, at a later time, probably with changed content.

So, the naming in Drafts would need to be the same and the order in which the files will be shown, which is the last modification time (at least I cannot remember that I changed this)

For this, you would just export like your actions does, with the modifcation to export the whole text and not drop the first line - and add the modification time to the files.

Doing this, you could then re-import those files and add them to the Drafts database like they were before - by just reading the modification time from the filename (which could have been changed) and set this timestamp again in the database.

Finish.

Most other wishes (if not based on access- or creation-times) could be done after export. Maybe it would be best to be able to choose which of the timestamp should be used, or maybe even allow very long filenames and add all three timestamps to the filenames.

Then, you could easily get a selections of notes our of Drafts and later back into Drafts. The export and import from Bear seems to work like this - and this is a very very useful basic export!

And it is way better than exporting just any and all notes as a concatenation in one file - who could use this?!?

Example code for import:

export(file, draft.firstline()+“_”+draft.mtime())

Example code for import:

import(draft,draft.mtime=(file.name.mtime()))

Something like this …