Just for record:
#!/bin/bash
# to be able to process blanks in file names - remember original state:
OFS=$IFS
# set new:
IFS="
"
BaseDir="qelectrotech-elements"
for d in `find $BaseDir -type d | sort`; do
echo "processing directory $d"
# html-Header:
echo "<html><body>" > $d/index.html
echo '<li><a href="../index.html">← Parent Directory </a></li><br><li><button class="spectrum-Button spectrum-Button--sizeM spectrum-Button--cta svelte-1gv5n3y cd17fc8d794774a44aa5bbe652ad93894-dom" onclick="history.back()">Back return</button></li>' >> $d/index.html
# Unterverzeichnisse auflisten:
for sd in `find $d -maxdepth 1 -type d | sort`; do
if [[ "$d" == "$sd" ]] ; then
continue
fi
echo "sub-dir: $sd"
echo "<a href=\"`basename $sd`/index.html\">`basename $sd`</a><br>" >> $d/index.html
done
# SVG-Dateien auflisten:
for f in `find $d -maxdepth 1 -name "*.svg" | sort` ; do
echo "file: `basename $f`"
svgdatei=`basename $f`
elmtdatei="${svgdatei%.svg}.elmt"
echo "<a href=\"$elmtdatei\" download>${svgdatei%.svg}<br> <img src=\"$svgdatei\" /></a><br><br>" >> $d/index.html
done
# html-Footer:
echo "<li><a href="../index.html">← Parent Directory </a></li><br><a href="#" class="btn btn-default">Back to top ↑</a>" >> $d/index.html
echo "</body></html>" >> $d/index.html
echo ""
done
# blanks in filenames - back to original:
IFS=$OFS
# DONE!