website/scripts/mkphotoindex.sh
2022-12-27 22:04:45 +01:00

37 lines
648 B
Bash

#!/bin/sh -e
echo "<h1>My Photos</h1>"
[ -f index.txt ] && cat index.txt
makelink() {
_text="$(echo "$1" | sed 's/-/ /g;s/_/ - /g;s/\(....\) \(..\) \(..\)/\1-\2-\3/')"
echo "<li><a href=\"${_dir}\">${_text}</a></li>"
}
echo "<h3>Events:</h3>"
echo "<ul>"
find * -maxdepth 0 -mindepth 0 -type d \
| grep "^20" \
| grep -v "unlisted" \
| sort -r \
| while read _dir
do
makelink "$_dir"
done
echo "</ul>"
echo "<h3>Collections:</h3>"
echo "<ul>"
find * -maxdepth 0 -mindepth 0 -type d \
| grep -v "^20" \
| grep -v "unlisted" \
| sort -r \
| while read _dir
do
makelink "$_dir"
done
echo "</ul>"