I have got about 6,000 old daily notes that I want to bring into Obsidian. Unfortunately, the file names are formatted like this:
54 Wednesday, 12 December 2012.md
55 Thursday, 13 December 2012.md
56 Friday, 14 December 2012.md
I would like to change them to:
2012-12-12-Wednesday.md
2012-12-13-Thursday.md
2012-12-14-Friday.md
Is there a way I could use regex or anything else to rename all the files?
Thanks
Angel
1 Like
AND
August 5, 2021, 9:51am
2
Looking for a tool that can do this myself. Let us know if you find one, it is very useful!
Many thanks. I have tried a few renaming apps, but can’t get anything to work as I need it to. If I can figure out the regex, I will post it here. I have managed to get the files down to this format:
Friday/5/October/2012
Friday/12/October/2012
However, I can’t get the regex to ‘find’ the right pattern and then replace it as:
2012-10-05-Friday
2012-10-12-Friday
Hope to get there eventually.
Angel
I am very grateful. And edging closer to a solution.
Thanks
Angel
With thanks to @stevelw for the pointers, I devised a convoluted method that worked. I am sure someone else would be able to come up with a simpler solution. Here goes (on macOS):
Copy original files in Finder to create a backup
Download Renamer
Find comma, replace with nothing
Find close bracket, replace with nothing
Find space, replace with underscore
Remove prefixes (in Finder), using the Automator Quick Action described in this thread
Find underscore, replace with forward slash
Add leading zero (for days with a single digit only) using regex
FIND:
\b(\d)(?=/)
REPLACE:
0$1
Find and replace months with digits: January = 01, February = 02, etc
All the files now in dddd/DD/MM/YYYY format
Use Regex to change the order of the four identifiable parts
FIND:
^(.+?)/(?<day>\d{1,2})/\b(?<month>\d{1,2})/(?<year>\d{2,4})\b
REPLACE
$4-$3-$2-$1
All files now in YYYY-MM-DD-dddd
Copied files into Obsidian
Angel
2 Likes
system
Closed
August 6, 2021, 8:34pm
8
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.