#!/bin/bash
DIR=$(pwd)
OUTPUT=$DIR/index.html
HTML="
random0.xxe.ro
"
for FILE in "$DIR"/*
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