#!/usr/bin/env bash set -e FILES="$(find . -maxdepth 2 -mindepth 2 -type d | sed '/git/d' | xargs stat -c '%n %y' | awk '{print $2"T"$3$4" "$1}')" [ ! -d github-style-site ] && echo "github-style-site directory not found" && exit 1 [ ! -d github-style-site/content/post ] && mkdir -p github-style-site/content/post while IFS= read -r line; do DATE="$(echo "$line" | awk '{print $1}')" NAME="$(echo "$line" | awk '{print $2}' | sed 's/\.\/// ; s/\//-/g')" FILENAME="$(echo "$line" | awk '{print $2}' | sed 's/\.\/.*\///g')" cat > github-style-site/content/post/"$FILENAME".md <<- EOF --- title: "$FILENAME" date: $DATE draft: false --- EOF done <<< "$FILES" # 2024-03-18T12:37:38.386289458-0400 ./Rust/dfr