#!/usr/local/bin/bash # # REFLECTORY: Build the Directory of CDs in this Site. # TOTALFILES="" TOTALSIZE="" O="directory.html" echo "
" >>$O
echo "Entries in Red were grabbed from the Net, and so there has been no" >>$O
echo "verification that they're complete or accurate. But something's better" >>$O
echo "than nothing.
A list of each directory's addition date is here" >>$O
echo "
Name of CD-ROM and Year" >>$O echo " | Number of Files" >>$O echo " | Size in KBytes" >>$O
for dire in *
do
if [ -d "$dire" ]
then
if [ -f "$dire/.name" ]
then
touch "$dire/.name"
if [ ! -f "$dire/.files" ]
then
echo "[!] $dire has no filecounts. Fixing."
FILES="`find $dire -type f | wc -l`"
SIZE="`du -s $dire | cut -f1`"
echo "--- $FILES files, $SIZE total size."
echo "$FILES" >"$dire/.files"
echo "$SIZE" >"$dire/.size"
fi
NAME="`cat $dire/.name`"
SUBNAME="`cat $dire/.subname`"
YEAR="`cat $dire/.year`"
FILES="`cat $dire/.files`"
SIZE="`cat $dire/.size`"
let TOTALFILES=$(($TOTALFILES+$FILES))
let TOTALSIZE=$(($TOTALSIZE+$SIZE))
if [ -f "$dire/.month" ]
then
YEAR="`cat $dire/.month` $YEAR"
fi
# If this is some crap I downloaded off the net, then make sure it's
# a different color.
PROBATION="#111133"
if [ -f $dire/.probation ]
then
PROBATION="#331111"
fi
if [ -f "$dire/.collection" ]
then
PROBATION="#222255"
CDS=`ls $dire | grep ^[a-z] | grep -v index.html | wc -l`
echo "" >>$O
echo "" >>$O
echo "$NAME | " >>$O echo "$CDS CDs ($YEAR) " >>$O echo " $FILES" >>$O
echo " | $SIZE" >>$O
else
echo "" >>$O
echo "" >>$O
echo " | " >>$O
echo "$NAME | " >>$O echo "$SUBNAME ($YEAR) " >>$O echo " $FILES" >>$O
echo " | $SIZE" >>$O
fi
if [ -f "$dire/.index.html" ]
then
echo " | " >>$O
fi
else
if [ -n "$1" ]
then
echo "$dire has no .name."
fi
fi
fi
done
echo " | " >>$O
echo " | $TOTALFILES" >>$O
echo " | $TOTALSIZE" >>$O
echo " | |
Thanks to a bunch of people, including Erik Pederson, Peter Simpson, Chuck Gilbert, Koos van den Hout, MCbx, and Tim Hazel,
who have donated, mailed, or uploaded dozens and dozens of CD-ROMs for this site.