Renaming Markdown Files Based on Front Matter Date Using Bash Script
Managing files with meaningful and structured names can greatly enhance organization and accessibility. Suppose you have a collection of Markdown files containing Front Matter sections, each with a “date” field. You want to rename these files using the date from their Front Matter section to create a consistent and informative naming scheme. This article will guide you through achieving this task using a bash script on macOS.
Prerequisites
- Basic familiarity with the command line interface (CLI).
- A macOS environment with bash, grep, awk, and date utilities.
Scenario
Let’s say you have a set of Markdown files in a folder. You want to rename these files based on the date mentioned in their Front Matter sections. Additionally, you want to exclude renaming any files named “README.md” or “template.md.”