#!/bin/bash
OUTPUT=$(pwd)/index.html
HTML="
random0.xero.nu
"
for FILE in "$search_dir"/srv/http/0/*
do
EXT=$(awk -F'.' '{print $NF}' <<< $FILE)
if [ $EXT = "gif" ] || [ $EXT = "jpg" ] || [ $EXT = "jpeg" ] || [ $EXT = "png" ] ; then
NAME=$(awk -F'/' '{print $NF}' <<< $FILE)
SIZE=$(cat $FILE | wc -c)
for DESIG in bytes kb mb gb tb pb
do
[ $SIZE -lt 1024 ] && break
let SIZE=$SIZE/1024
done
HTML+="- $NAME{$SIZE $DESIG}
"
fi
done
HTML+="
"
echo $HTML > $OUTPUT