#!/bin/sh
#
# bad-dxo-files -- find files that failed DxO conversion
#       i.e., files that match the criteria specified in bad-dxo-files

[ -n "$echo" ] && set -x

USAGE='rm-bad-dxo-files [directory] ...'

if test $# -eq 0
then
    set -- .
fi

CURRENT_DIR=`pwd`
for d in "$@"
do
    echo $d
    cd "$d" || exit 2
    BAD_FILES=`bad-dxo-files`
    if test -z "$BAD_FILES"
    then
	echo "No files to remove!"
    else
	for f in $BAD_FILES
	do
	    echo "removing $f"
	    rm $f || exit 3
	done
    fi
    cd "$CURRENT_DIR" || exit 4
done
