#!/bin/tcsh

### Scans the inputs and writes raw PCM files for later use by scan-many-eas-niced-raw.
###
### First arg is the directory for the results; all later args are inputs, which may
### also be directories (since they're scanned via ls).

set outdir = $1; shift

if (! -d $outdir) then
  echo "$1 must be a directory."
  exit 1
endif

foreach x (`ls $*`)
  if (-l $x && ! -e `readlink $x`) then
    echo "`date`	Dangling link:  $x"	# Doesn't point anywhere, so can't scan it.
  else
    pcm-quiet $x > $outdir/`basename $x`
    echo "`date`	$x" >>! ~/PCM.corpus
  endif
end
