Visit Counter

Tuesday, June 5, 2012

Unix Script for Copy Files to another Directory




root@test-server # cat mvfile.sh


SRCE_DIR=${HOME}/oradat/ssdb/archive1
DEST_DIR=${HOME}/backup/archive1

cd ${SRCE_DIR}

for FILE in `ls -1A *.dbf`
do

  if [ ! -f ${DEST_DIR}/${FILE} ]
  then
    echo 'Transferring file: '${FILE}
    cp "${FILE}" "${DEST_DIR}/${FILE}"
   
echo 'Transfer completed.'
  else
    echo 'The file: '${FILE}' already exists in '${DEST_DIR}'.'
  fi
done
root@test-server #

No comments:

Post a Comment