A simple Deno CLI tool to manage the date
field in Obsidian vault markdown files' frontmatter.
- Scans markdown files in an Obsidian vault recursively
- Identifies files missing the
date
field in their frontmatter - Automatically adds the
date
field using file creation date when run with write permissions - Preserves existing frontmatter structure and other fields
- Deno version 2.x or higher
Run the script directly:
deno run --allow-read --allow-write jsr:@zanza00/obsidian-date-adder /path/to/vault
If you want to only view files without modifying them, omit the --allow-write
flag:
deno run --allow-read jsr:@zanza00/obsidian-date-adder /path/to/vault
Example output:
File: /path/to/vault/notes/example-note.md
Created: 2024-01-15T10:30
Current Frontmatter:
id: abc123
tags:
- note
- example
File updated with new date field
---
The date is added in the format: YYYY-MM-DDTHH:mm
For example: 2024-01-15T10:30
- The script will only modify files that don't already have a
date
field - The script uses the file's creation date for the
date
field - Only
.md
files are processed - Files without frontmatter are ignored
- Existing frontmatter fields are preserved
- Run with
--allow-write
to automatically update files, omit it to only view files
MIT