Scripting

Batch File Renaming The Lazy Way

When I first converted my blog over to hugo from hakyll, I neglected to put the date published onto the front of the blog posts file names. This resulted in URLs that were slightly less descriptive than desired, and also made it harder to scan through the markdown files quickly. Luckily in each file is a header, and within each header is a date field. Therefore, with my rusty old bash trickery I was able to spit out the following one-liner to do the job of renaming all the files.