#!/usr/bin/env bash # Usage: ./run_batch_analysis_analysis.sh /path/to/target_dir set -euo pipefail if [[ $# -ne 1 ]]; then echo "Usage: $0 /path/to/target_dir" exit 1 fi TARGET_DIR="$1" if [[ ! -d "$TARGET_DIR" ]]; then echo "Error: '$TARGET_DIR' is not a directory." exit 1 fi # Find all results.csv files directly under subdirectories find "$TARGET_DIR" -mindepth 2 -maxdepth 2 -type f -name results.csv | while IFS= read -r csvfile; do echo "Analyzing $csvfile" ./batch_analysis_analysis.py -i "$csvfile" done