#!/bin/bash # Get the current script directory of the script SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" # lm-eval-output dir PROJECT_DIR="$(dirname "$SCRIPT_DIR")" BASE_DIR="$PROJECT_DIR/lm-eval-output" echo "===================================================" echo "Compressing all jsonl files in $BASE_DIR" echo "===================================================" # Find all directories containing .jsonl files, without duplicates find "$BASE_DIR" -type f -name '*.jsonl' | awk -F/ 'BEGIN{OFS="/"}{$NF=""; print $0}' | xargs -I {} readlink -f {} | sort -u | while read -r DIR do # Process each directory bash "$SCRIPT_DIR/build-jsonl-archive-in-folder.sh" "$DIR" & # sleep 1 done # Sleep for 5 second to allow the background processes to start sleep 5 # Wait for all background processes to finish wait wait wait # Sleep for 1 second to allow the background processes to finish / echo logs to flush, etc sleep 1 # Done echo "===================================================" echo "All jsonl files in $BASE_DIR have been compressed" echo "==================================================="