#!/usr/bin/env bash # Download DOP JP2/J2W/XML tiles listed in filelist.txt. set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" LIST="$ROOT/filelist.txt" OUT="$ROOT/jp2" if [[ ! -f "$LIST" ]]; then echo "Missing filelist: $LIST" >&2 exit 1 fi mkdir -p "$OUT" while IFS= read -r url; do [[ -z "$url" || "$url" =~ ^# ]] && continue fname="${url##*/}" dest="$OUT/$fname" if [[ -f "$dest" ]]; then echo "Exists: $fname" continue fi echo "Downloading $fname" curl -fL "$url" -o "$dest" done < "$LIST" echo "Done. Files in $OUT"