#! /bin/bash

# Removes all files under ${dir} that are identical to the corresponding
# files iin ${ref}

dir="$1"; shift
ref="$1"; shift

files=( `mc857_find_identical_files.sh ${dir} ${ref}` )

echo "removing these files in ${dir} that are identical to those in ${ref}" 1>&2
ls -l "${files[@]}"
ans="`mc857_ask_for_yes_or_no.sh`"
if [[ "${ans}" != "yes" ]]; then
  echo "** you said '${ans}' - aborted." 1>&2
  exit 1
fi

rm -fv "${files[@]}"
