Importing from Day One: a reasonably definitive guide

Just in case it’s ever helpful for someone trying to do the same thing I thought it might be helpful to record the procedure I’ve finally adopted for importing into DT entries from my Day One journal.

The result of the procedure are single markdown files which preserve the original Day One data and which are each named with the date of the entry.

The problems

Day One enables export of entries in JSON, pdf, HTML and plain text/markdown formats. The difficulty is that when you select multiple entries the result is a single file containing all the entries.

It is possible to export to JSON and convert to single markdown entries by using the Bear app but you do lose some useful Day One data in the process (for example, the date, location and weather headings for each entry). Further some markdown does not survive that process (tables, for example).

What you will need

In Finder create a folder dedicated to receive the entries exported from Day One. I’ll call that the Journal Folder.

You need a terminal command, (which I’ll call the Terminal Command) which looks like this:
split -p ‘^ Date:’ journal.txt out

Don’t omit the single quotation marks and note that there is tab before “Date:” You enter that in Terminal by typing Ctrl+V and then pressing the tab key.

You will be batch renaming files in Finder so make sure you know how to do that. (I use ForkLift which makes that a little easier.)

The procedure

  1. In Day One select the entries you wish to export and import into DT.
  2. Export those entries as plain text/markdown into the Journal Folder. For the purposes of this post I’ve called the file you create journal.txt.
  3. The export will create a zip file so extract from it the journal.txt file and any photo folder.
  4. Open Terminal, navigate to the Journal Folder and then run the Terminal Command (which will split the journal.txt file into individual entries for each date).
  5. In Finder go to the Journal Folder, delete the journal.txt file and select all of the other files in the folder (save for any photo folder). Batch rename those files to add the .md extension.
  6. In DT select the folder into which you wish to import the journal entries, open the Journal Folder and import all entries from it (including any photo folder).
  7. In DT select all the imported markdown files (i.e., excluding any photo folder), go to Tools > Batch Process and choose “Change Name” to “Oldest Document Date” (which will pick up the creation date of each entry).
  8. If any entry has a photo attached to it you will need to ensure you are in edit mode (rather than preview mode) for that entry, delete the old link and then drag the relevant photo into the entry to create the correct link in DT.

Disclaimer

I am no great expert and am sure it’s possible to improve this procedure. However, the procedure is the best way I have discovered of preserving all Day One data and markdown in DT.

Although the process sounds rather convoluted it’s not at all bad once you get the hang of it. For example, if you leave open the Terminal window all you need to do (if you’re exporting multiple batches of entries) is, on each occasion, to press the up arrow key to recall the Terminal Command.

Stephen

7 Likes

Very nice write up, @Stephen_C
Thanks for sharing :slight_smile:

1 Like

I should update this thread with two warnings, a refinement and some encouragement.

Please note:

  1. The procedure outlined in the original post does not import Day One tags.
  2. If a journal entry includes a date older than the date of the entry itself step 7 in the procedure I outlined will provide an inappropriate name for the relevant file and you will have to amend that date manually in DT (but see also the refinement mentioned below).

In order to be able to sort entries chronologically I have amended step 7 of the original procedure as follows. (When doing this do make sure you have all the newly imported files in some temporary folder because you won’t want to change files you have previously imported):

7a. In DT select all the newly imported markdown files (i.e., excluding any photo folder), go to Tools > Batch Process and choose “Change Creation Date” to “Oldest Document Date”. That (subject to the warning mentioned in 2 above) should change the creation date of each entry to the date of the entry (making for much easier sorting in DT). Check there are no inappropriate creation dates (which is quick and easy) before proceeding to the next step.
7b. Now, in DT, with all the entries still selected, go to Tools > Batch Process and choose “Change Name” to “Creation Date”.

Finally drag and drop the newly imported entries from the temporary folder into the relevant folder in your DevonThink database.

By way of encouragement, steps 3, 4 and 5 of the original procedure can be automated with Hazel rules. Steps 7a and 7b above can be automated (save for the checking in step 7a) by DT smart rules (and I’ve added to the second rule an action which locks each file). Once you have the hang of the procedure, and the appropriate rules, it’s very quick and easy—in spite of these long-winded explanations.

Stephen

2 Likes

For anyone finding this old topic please note that there’s a much updated version of the guide here.

Stephen

1 Like