I’m migrating my notes into Drafts and wanted to know if there’s a way to bulk import .md files while also preserving the date/time of the file? Every time I import notes, they get lumped to the top of my list and set to today’s date/time.
As Andreas notes, the creation property is read only for scripting, and as you’ve noted, the standard non-scripting import processes create “now” and so the timestamps reflect that.
There is a way to do it, but it needs a bit of work to do:
Now, it would be possible on the Mac to build an automation to convert a file into a Drafts json file ready for import. Pretty much any scripting language is going to let you read file meta data (creation date, etc.) and write it out to a text file with the content and some standard text to create the JSON. The ease of doing so just depends on what tools or scripting languages you are comfortable working with, and how well suited they are to this sort of thing.
awesome thanks everyone. I’ve got got a lot of programming experience, so should be easy. one question: where can I export as JSON from Drafts so I can see what the format looks like? I can only see export as plain text as an option in the latest app.
Looks pretty close. You need a tags: [ ] key, even if not assigning tags and the dates should be valid ISO 8601 dates, which need a time zone specifier…which means just add a Z at the end if your dates are already UTC dates.
[Update: Also, the long/lat should be numbers, not strings. Do not wrap them in quotes]