echo
echo "Sunbelt UNIX cleanup Command Script   Version 9.1   28 Feb 2006"
echo "(C) Copyright 1987-2006   Sunbelt Computer Systems, Inc\\n"
 
if [ "$1" = "-?" -o $# = 0 ]
then
echo "cleanup - Sunbelt script to perform multiple file deletes (UNIX rm) with"
echo "          verification.  Supports use of UNIX wildcards"
echo
echo "example: cleanup *.dbs (Delete w/ verification files with extension .dbs)"
echo "         cleanup *.*   (Delete w/ verification files with an extension)"
echo "         cleanup *     (Delete w/ verification all files in directory)"
echo
    if [ $# = 0 ]
    then
        echo "COMMAND LINE ERROR!  A file name or valid wildcard is required."
    fi
exit 1
fi
 
for i in `ls $*`
do
 case $i in
      *[$*]) echo "Delete '"$1"' (Y/N)? \c"
             read ANSWER
                if [ "$ANSWER" = "Y" -o "$ANSWER" = "y" ]
                then
                    rm $1
                    if [ $? = 0 ]
                    then
                        echo "'"$1"' successfully deleted!\\n"
                    else
                        echo "Unable to delete '"$1"' - Verify access rights!"
                    fi
                else
                    echo "I didn't think so!\\n"
                fi
            shift;;
 esac
done
