Note:
I need some help.
I’m looking for a technique to rename a bunch of files and folders.
2005_03_19_this_is_the_filename.md -> 2005/03/this_is_the_filename/index.md
2007_07_23_another_filename.md -> 2007/07/another_filename/index.md
2021_01_12_filename.md -> 2021/01/filename/index.md
Here’s the regex I want to use:
- Regex:
/(\d{4})_(\d{2})_(\d{2})_(.*).md/gm
- Substitusion:
$1/$2/$4/index.md
Webmentions
DivKid
just tried it and yes it does. mrrsoftware.com/namechanger/ (newer version that me, looks similar and should work the same of course).
ar.al🌻
ar.al🌻
@alienlebarge Ah, I thought you needed help on the RegExp :)
What OS are you on?
ar.al🌻
@alienlebarge Ah, I thought you needed help on the RegExp :)
What OS are you on?
ar.al🌻
Cédric Aellen
@aral I managed to do it. Here's the command I used: `$ rename -p 's~(\d{4})_(\d{2})_\d{2}_(.+)(\.md)$~$1/$2/$3/index.md~' *.md`
Cédric Aellen
@aral I managed to do it. Here's the command I used: `$ rename -p 's~(\d{4})_(\d{2})_\d{2}_(.+)(\.md)$~$1/$2/$3/index.md~' *.md`