#!/bin/bash

# specify the starting dir
# else, current dir
DIR="${1:-.}"

# find all files with suffix .jsonl or .csv
find "$DIR" \( -iname "*.jsonl" -o -iname "*.csv" \) -type f | while read -r file; do
    echo "Compressing $file"
    # compress, -f means overwritting existing .gz files
    gzip -f "$file"
done

echo "Compression completed."
