WAIS indexing directory hierarchies

kevinh@pulua.hcc.hawaii.edu (Kevin 'Kev' Hughes)
Date: Fri, 26 Nov 93 01:42:45 HST
From: kevinh@pulua.hcc.hawaii.edu (Kevin 'Kev' Hughes)
Message-id: <9311261142.AA14423@pulua.hcc.Hawaii.Edu>
To: www-talk@nxoc01.cern.ch
Subject: WAIS indexing directory hierarchies

	Thanks to Marc's excellent "Mosaic and WAIS Tutorial", I've
managed to get a WAIS server up and running. But to index our entire
Web directory tree, I ran into some problems. Using the -r flag to
waisindex would only work if I tried to index *all* files in the
directories. When waisindex hit a directory as an option, only then would
it go into it.
	I didn't want this, so I made the small shell script below. I'm
not sure if it's entirely correct for indexing, but it seems to do the trick.
I can't wait until the day when WAIS servers can return full URLs!

	-- Kevin

---

#! /bin/csh

set rootdir = /www
set index = /usr/local/etc/http/index
set indexprog = /usr/local/etc/http/waisindex

cd $rootdir
set num = 0
foreach pathname (`du $rootdir | cut -f2 | tail -r`)
	cd $pathname
	echo "Current pathname is: $pathname"
	if ($num == 0) then
		set exportflag = "-export"
	else
		set exportflag = "-a"
	endif
	$indexprog -d $index $exportflag -T HTML *.html
	$indexprog -d $index -a -T TEXT *.txt
	$indexprog -d $index -a -T PS -nocontents *.ps
	$indexprog -d $index -a -T GIF -nocontents *.gif
	$indexprog -d $index -a -T AU -nocontents *.au
	$indexprog -d $index -a -T HQX -nocontents *.hqx
	$indexprog -d $index -a -T XBM -nocontents *.xbm
	$indexprog -d $index -a -T MPG -nocontents *.mpg
	$indexprog -d $index -a -T C -nocontents *.c
	@ num++
end
echo "$num directories were indexed."