#!/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 "
" >>$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 " |