#!/bin/sh
# ####################################################################
# Exceed Connection Server 13.7
# Copyright (c) 1997-2009 Open Text Corporation. All Rights Reserved.
# ####################################################################
# Migration Tool
# $Revision: 10408 $
#######################################################################

if [ ${OSTYPE:="UNKNOWN"} = "Linux" \
    -o $OSTYPE = "linux-gnu" \
    -o $OSTYPE = "linux" \
    ]; then
        ECHO="echo -e"
    else
        ECHO="echo"
    fi
export ECHO

oldDir=$1
newDir=$2
fileName=$3
newFileName=$4

oldFile=${oldDir}${fileName}

if [ ! -f "${oldFile}" ] ; then 
  exit 0
fi

newFile=${newDir}${fileName}

if [ -f "${newFile}" ] ; then
  cmp "${oldFile}" "${newFile}" > /dev/null 2>&1

  if [ ! $? = 0 ] ; then
    cp -p "${oldFile}" "${newDir}${newFileName}"
    exit 1
  fi
else
  cp -p "${oldFile}" "${newDir}${fileName}"
fi

exit 0
