Add tif-index2.json

erstellt eine index datei für alle tif dateien im Verzeichnis /scans/thinsection/cog_out
This commit is contained in:
Brus 2026-05-27 15:41:09 +02:00
commit e1538a1eda

36
tif-index2.json Normal file
View file

@ -0,0 +1,36 @@
#!/bin/bash
BASE="/scans/thinsect/cog_out"
OUT="/var/www/html/tif-index.json"
echo "{" > "$OUT"
FIRST=true
find "$BASE" -name "*.tif" | while read FILE
do
#
# Dateiname ohne .tif
#
NAME=$(basename "$FILE" .tif)
#
# relativer Pfad
#
REL="${FILE#$BASE/}"
if [ "$FIRST" = true ]; then
FIRST=false
else
echo "," >> "$OUT"
fi
echo -n " \"$NAME\": \"$REL\"" >> "$OUT"
done
echo "" >> "$OUT"
echo "}" >> "$OUT"
echo "fertig: $OUT"