#!/bin/bash
NOTES_DIR="notes"
for f in $NOTES_DIR/*.org; do
    CREATED=$(git log --diff-filter=A --format=%aI -- "$f" | tail -1)
    EDITED=$(git log -1 --format=%aI -- "$f")
    # If not in git, use file mtime
    [ -z "$CREATED" ] && CREATED=$(date -Iseconds -r "$f")
    [ -z "$EDITED" ] && EDITED=$(date -Iseconds -r "$f")
    echo "$f|$CREATED|$EDITED"
done
