#!/bin/bash
BACKUP_DIR="/home/aaron/nextcloud/data/data/aaron/files/Admin/Backups"
DATE=$(date +%Y-%m-%d)
mkdir -p "$BACKUP_DIR"

# Copy critical files
cp ~/aaronai/memory.md "$BACKUP_DIR/memory-$DATE.md"
cp ~/aaronai/settings.json "$BACKUP_DIR/settings-$DATE.json"
cp ~/aaronai/conversations.db "$BACKUP_DIR/conversations-$DATE.db"

# Keep only last 7 days
find "$BACKUP_DIR" -name "*.md" -mtime +7 -delete
find "$BACKUP_DIR" -name "*.json" -mtime +7 -delete
find "$BACKUP_DIR" -name "*.db" -mtime +7 -delete

echo "Backup complete: $DATE"
