Skip to content
Snippets Groups Projects
compare_two_copies.bash 1.13 KiB
#! /bin/bash


source ~/.bash_profile


golden_path=/data/common/GEOCAT_ANCILLARY_DATA/navigation/
subdir=$(basename $golden_path)
test_path=/data/justins/gancil/geocat-ancillary/data/${subdir}/


ls -1 $golden_path > $(pwd)/golden_list_${subdir}.txt
ls -1 $test_path > $(pwd)/test_list_${subdir}.txt

outfile=$(pwd)/${subdir}_comparison_report.txt
rm -f ${outfile}

while read line
do
  grep -i $line $(pwd)/test_list_${subdir}.txt
  if [ $? -ne 0 ]
  then
    echo "$line | exists in golden but not test" >> ${outfile}
  fi
done<$(pwd)/golden_list_${subdir}.txt

echo "############################" >> $outfile

while read line
do
  grep -i $line $(pwd)/golden_list_${subdir}.txt
  if [ $? -ne 0 ]
  then
    echo "$line | exists in test but not golden" >> ${outfile}
  fi
done<$(pwd)/test_list_${subdir}.txt

echo "############################" >> $outfile

while read line
do
  grep -i $line $(pwd)/test_list_${subdir}.txt
  if [ $? -eq 0 ]
  then
    diff ${golden_path}/$line ${test_path}/$line > /dev/null 2>&1
    if [ $? -ne 0 ]
    then
      echo "${line} | files did not match." >> ${outfile}
    fi
  fi
done<$(pwd)/golden_list_${subdir}.txt

exit