#!/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/webfiles/filestats.html" echo "T E X T F I L E S" >$I echo "" >>$I echo "

WEB.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/webfiles/.directories` do nfiles="`ls -R /textfiles/webfiles/$directory | grep -v .html | wc -l`" bytes="`/usr/local/bin/du -sb /textfiles/webfiles/$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