#!/usr/bin/env bash # Copy concert WAV files from the curator's Dropbox folder into content/audio/, # stripping the ` Brianna` suffix that the source files carry. # Idempotent: skips files that already exist at the destination. set -euo pipefail SRC_DIR="${SRC_DIR:-$HOME/Dropbox/File requests/Mill Run Audio}" DEST_DIR="${DEST_DIR:-$(cd "$(dirname "$0")/.." && pwd)/content/audio}" if [[ ! -d "$SRC_DIR" ]]; then echo "error: source directory not found: $SRC_DIR" >&2 exit 1 fi mkdir -p "$DEST_DIR" count=0 copied=0 skipped=0 shopt -s nullglob for src in "$SRC_DIR"/*.wav; do count=$((count + 1)) name=$(basename "$src") # Strip trailing " Brianna.wav" → ".wav" dest_name="${name% Brianna.wav}.wav" dest="$DEST_DIR/$dest_name" if [[ -f "$dest" ]] && [[ $(stat -c %s "$src") -eq $(stat -c %s "$dest") ]]; then skipped=$((skipped + 1)) continue fi printf ' [%2d] %s\n' "$count" "$dest_name" cp -- "$src" "$dest" copied=$((copied + 1)) done printf '\n%d total · %d copied · %d skipped (already present)\n' "$count" "$copied" "$skipped"