#!/bin/sh # # FILESTATS: Make a File Stats Page that tells you all the goodies # about textfiles.com and lets you see how big the thing is. I="/textfiles/filestats.html" echo "T E X T F I L E S" >$I echo "" >>$I echo "

TEXTFILES.COM File Statistics

" >>$I echo "This Document Was Last Updated at `date`" >>$I echo "

" >>$I echo "" >>$I echo "
 Directory" >>$I echo " # of Files" >>$I echo " Size of Directory" >>$I for directory in `cat /textfiles/.directories` do nfiles="`ls -R /textfiles/$directory | grep -v .html | wc -l`" bytes="`/usr/bin/du -sb /textfiles/$directory | cut -f1`" tfiles=$(($tfiles + $nfiles)) tbyte=$(($tbyte + $bytes)) echo "
 $directory" >>$I echo "  `/textfiles/magic/comma $nfiles`" >>$I echo "  `/textfiles/magic/comma $bytes`" >>$I done echo "
 Totals" >>$I echo " `/textfiles/magic/comma $tfiles` files" >>$I echo " `/textfiles/magic/comma $tbyte` bytes" >>$I echo "
" >>$I echo "" >>$I