export PATH=/usr/local/opt/coreutils/libexec/gnubin:$PATH
Or update the script to use /usr/local/opt/coreutils/libexec/gnubin/date
jimw:
I’ll write more complete notes on how I did this for future Windows users later in the week
Hey, any update on that step-by-step Windows conversion guide? Would love to be able to convert these daily note pages with links intact. (And daily more annoyed that Roam devs thought this naming convention would be a good idea in the first place)
I believe @jimw 's issues were due to onedrive not having all the files downloaded.
The script should just work if you
I’ve installed Ubuntu from the Windows store and have created the “convert_daily_notes.sh” file within the relevant vault using the nano editor.
So if you install the Windows Subsystem for Linux the script should just work in that environment. You can ignore the MacOS X instructions. (I don’t have a windows install handy to confirm this).
Lets say I’m a year in to using Obsidian and have already used this script successfully to convert everything during my initial migration from Roam, but continued using the “MMMM Do, Y” format for my Daily Notes (and their file names). Realizing now that I should’ve stuck with the YYYY-MM-DD format due to the majority of plugins I use referencing the YYYY-MM-DD format.
Could I technically run this convert all of my dates, file names, (and any date shown on any note using “MMMM Do, Y” to “YYYY-MM-DD” format?
I use MacOS 13.1 and followed the instructions to brew install bash gnu-sed gnutls. I kept running into issues when setting the environment, but managed to get it up and running by specifying gdate, gsed and gtouch in the code.
#/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
roam_date_to_obsidian() {
gdate --date="$(echo "${*}" | gsed 's/th//;s/nd//;s/rd//;s/1st/1/')" \
'+%Y-%m-%d'
while IFS= read -r line; do
roam_daily_note=${line/%.md/}
obsidian_daily_note=$(roam_date_to_obsidian ${roam_daily_note})
# add front matter
echo "---" >> ${obsidian_daily_note}.md
echo "tags: [daily]" >> ${obsidian_daily_note}.md
echo "---" >> ${obsidian_daily_note}.md
cat "${roam_daily_note}.md" >> ${obsidian_daily_note}.md
# update links
gsed -i "s/\[\[${roam_daily_note}]]/[[${obsidian_daily_note}]]/g" *.md */*.md || true
# give it a relevant timestamp
gtouch -d ${obsidian_daily_note} ${obsidian_daily_note}.md
rm "${roam_daily_note}.md"
done```
Just in case it helps someone else.
Your approach is neat - doing this conversion in Road Research vault rather than Obsidian vault. Thanks for sharing!
For me I would need a slightly different approach, as I already migrated from Roam Research to Obsidian a few years ago. I have a few thousand legacy daily note files from Roam that follow the annoying month-day-year format, and a few thousand daily notes from Obsidian that follow YYYY-MM-DD format.
This shell script served me well. At least I could rename all the legacy daily note files into a uniform YYYY-MM-DD.md convention, though the links inside those old notes remain unchanged.
duh… this forum doesn’t allow link. That’s a bummer. Well, my shell script can be found on my site, digitalsovereignty.herbertyang.xyz