3# Directory containing this script
4SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6# Path to the posts directory relative to the script location
7POSTS_DIR="$SCRIPT_DIR/../web-ui/public/posts"
8INDEX_FILE="$POSTS_DIR/index.txt"
10# Create posts directory if it doesn't exist
11mkdir -p "$POSTS_DIR"
13# Find all .md files in the posts directory and write to index.txt
14find "$POSTS_DIR" -maxdepth 1 -name "*.md" -type f -printf "%f\n" | sort > "$INDEX_FILE"
16echo "Generated posts index at $INDEX_FILE"