Daily Notes/Journal Entries Index Generator [AppleScript]

I am using the Daily Notes plugin in Obsidian quite a bit and wanted a way to create an index for all the notes. I could generate a list of all the dates in a year and just create and index and be done with it. However, right now, I don’t put something in my daily notes every day so there are gaps. And I wanted to avoid having links to days where there are no notes.

So I gathered a bunch of scripts online (mainly from Apple’s help docs but also from other places) to get a list of all files in my Daily folder, remove extensions, sort alphabetically, format as wiki links, remove two extra files (one hidden .ztr-directory and one the index file itself) from the list and finally save it all in a file called _Journal Entries in the same Daily folder.

It is quite rough and I’ve not tested it with a lot of files, so use at your own risk and make backups before trying.

Instructions to use:

  1. Download the script here.
  2. Open the file and edit line #2

set the_folder to alias “Amun HD:Users:Rishi:Documents:Zettlekasten:Daily:”

to the path to your daily notes folder.

  1. Edit line #9,

set output to {"# Journal Entries

to what you want the heading to be of the Index file.

  1. Edit line #17,

writeTextToFile(output, (the_folder as string) & “_Journal Entries.md”, true)

to set the name of the filename you want for your index.
5. If you changed the filename in step 4, you also need to exclude it from the generated list, so edit line #27,

if myname contains “_Journal Entries” or myname contains “.ztr” or myname contains “.DS_S” then

and set your name here.

That’s all folks! Enjoy!

4 Likes