Update Markdown file creation dates

As I’ve migrated files between different apps over the years, in many cases the act of exporting or recreating notes has created inconsistency between the actual creation date (metadata in Finder) and the date metadata added to the top of the file in YAML front matter.

This is a simple utility that takes a directory, finds Markdown files, checks front matter for either date: YYYY-MM-DD or date: MM-DD-YYYY, and updates the file’s creation date using the macOS setfile command.

Usage

python3 update_file_dates.py /path/to/your/documents

This script can be easily adjusted to support .txt files, other date front matter like created, or other date formats, if needed. Reach out if you have any questions or recommendations for improvements.