So I already have daily notes from 2022. It has always been YYYY-MM-DD. But Now I want reformat ALL existing daily notes into MMM Do, YYYY.
Is there a way to do that?
Things I have tried
I checked the Linter plugin. Doesn’t seem to fit my need.
So I already have daily notes from 2022. It has always been YYYY-MM-DD. But Now I want reformat ALL existing daily notes into MMM Do, YYYY.
Is there a way to do that?
I checked the Linter plugin. Doesn’t seem to fit my need.
You can use ChatGPT Plus ($20 / month) for this. It can bulk rename files according to your instructions. It can also generate shell scripts for this kind of problems.
From ChatGPT:
You can use the following PowerShell script to rename files that are named in the YYYY-MM-DD
format to the MMM dd, YYYY
format.
Here’s the script:
# Get all files in the directory (you can specify a path or use the current directory)
$files = Get-ChildItem -Path "C:\Path\To\Your\Files"
foreach ($file in $files) {
# Extract the base file name without extension
$baseName = [System.IO.Path]::GetFileNameWithoutExtension($file.Name)
# Match the date pattern YYYY-MM-DD using regex
if ($baseName -match '^\d{4}-\d{2}-\d{2}$') {
# Convert the date from YYYY-MM-DD to DateTime object
$date = [DateTime]::ParseExact($baseName, 'yyyy-MM-dd', $null)
# Format the date in MMM dd, yyyy format
$newName = $date.ToString("MMM dd, yyyy") + $file.Extension
# Rename the file
$newPath = Join-Path $file.DirectoryName $newName
Rename-Item -Path $file.FullName -NewName $newPath
Write-Host "Renamed '$($file.Name)' to '$newName'"
}
}
YYYY-MM-DD
pattern using regex (^\d{4}-\d{2}-\d{2}$
).DateTime
object.MMM dd, yyyy
(e.g., Jan 01, 2024
)."C:\Path\To\Your\Files"
with the path to your folder containing the files.This should rename all the files with the date in the YYYY-MM-DD
format to the desired MMM dd, yyyy
format.
Thank you so much. I 'm not a subscriber, and will explore other solution. If can’t find any other solution. Will try ChatGPT.
Thanks!
Just a few thoughts here:
So the thing is I have dates in other format (imported from other noting app). These dates are linked to actually journal date, but the format is different from my obsidian date format.
So, I was thinking to change the obsidian journal date format to MMM Do, YYYY, allowing the links to be established (probably need to reindex) and then change it back to YYYY_MM_DD. I think perhaps this way I could change all the date format and links both in title and in content back to original date format. So that I don’t have to re establish all date links in my other notes.
any thought to complete that ?
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.