Reorganising Obsidian Journal Notes
Using AI to help restructure my journal notes in an Obsidian vault
I finished off my previous post on journalling in Obsidian with a couple of wish lists:
I do have some improvements I wish to make such as moving notes away from their respective flat directories. i.e.:
- Daily notes move from
planner/daily
to be grouped by year and month:planner/daily/YYYY/MM
- Weekly notes move from
planner/weekly
toplanner/weekly/YYYY
- Monthly notes move from
planner/monthly
toplanner/monthly/YYYY
I’ve been playing around with AI code generation, specifically the Claude 3.7 Sonnet model, and I wanted to see if it could produce scripts to help with this.
Unfortunately I didn’t capture the exact prompts I used, but it was something along these lines:
There are markdown files in the date format
YYYY-MM-DD.md
found inplanner/daily
. Create a Python script that will group them in directories by their respective year and month. The Python script should include user confirmation before moving the files.
I repeated this for each note type, and finished with asking it to consolidate all the scripts into one for simplicity.
Consolidate all the scripts you’ve created into one.
You can find all the scripts on the Github gist link below.
https://gist.github.com/jdheyburn/f64effd0b606a68044d7d28960becc77
I strongly recommend backing up your vault and pausing your sync tool of choice before executing any of the scripts.

After the scripts run, notes are now grouped into tidier directories
Group new files
Now that existing files had been moved, I had to change the settings for the Periodic Notes plugin to template new files at their correct location:

I had to update the format of each periodic note as follows:
- Daily
YYYY/MM/YYYY-MM-DD
- e.g.:
2025/03/2025-03-21
- Weekly
YYYY/YYYY-[W]ww
- e.g.:
2025/2025-W12
- Monthly
YYYY/YYYY-MM-[M]
- e.g.:
2025/2025-03-M
- Quarterly
YYYY/YYYY-[Q]Q
- e.g.:
2025/2025-Q1
These get created under their respective note folder, e.g. planner/monthly
.
With all but daily notes, I’m prepending YYYY/
to the filename. Periodic Notes will see this as a directory and template out the format. Daily is prepended by YYYY/MM/
to allow for grouping on months too.
Updated explicit daily note links
From my previous post you would have seen daily notes link to adjacent days through an explicit link under planner/daily
.
# Monday 20th November 2023
<< [[planner/daily/2023-11-19|2023-11-19]] || [[planner/daily/2023-11-21|2023-11-21]] >>
[[2023-W47]] || [[2023-11-M]]
These links broke after the restructure because the notes are no longer directly underneath planner/daily
. I can’t remember the reason why I set it up this way; it might’ve been because I expected more daily notes in various locations. In either case I don’t have a need for it, so we can change these to implicit links. There are also implicit links to weekly and monthly notes, but these links will work fine as the files are still in the vault, Obsidian will be able to find them.
I also asked Claude to write me a bash one-liner to rename these.
There are markdown files under
planner/daily
that have text in the format[[planner/daily/2023-11-19|2023-11-19]] || [[planner/daily/2023-11-21|2023-11-21]]
. Write a bash command that converts them to[[2023-11-19]] || [[2023-11-21]]
.
I thought I’d have to be explicit with the date format, but it seemed to understand the context enough to imply it:
find planner/daily -name "*.md" -type f -exec sed -i '' -E 's/\[\[planner\/daily\/([0-9]{4}-[0-9]{2}-[0-9]{2})\|([0-9]{4}-[0-9]{2}-[0-9]{2})\]\]/[[\1]]/g' {} \;
This took just 2 seconds to run! I also made sure to backup my Obsidian vault before hand, in case it went a bit haywire.
My daily note template also needed updating so that new notes follow this:
# <% thisDayLong %>
<< [[<% previousDayFmt %>]] || [[<% nextDayFmt %>]] >>
[[<% thisWeek %>]] || [[<% thisMonth %>]]
Finally, I enabled syncing and watched as all the files were updated.
Thanks for reading!