Thursday, 22 May 2014

Unix Shell Script to Copy Files from One Directory to Another Directory

---------------------------------------------------------------------------
Unix Shell Script to Copy Files from One Directory to Another Directory
---------------------------------------------------------------------------
#!/bin/ksh
################################################################
# Display
the banner to announce that the program has started.
#################################################################
PROGRAM_NAME
=`basename $0`echo $PROGRAM_NAME "has started"
echo " "
########################################
# Oracle Concurrent
Program parameters #########################################
#total_args
=`echo $*|awk '{print NF}'`##############
#
Source File###############
SOURCE_FILE
=`echo $*|awk '{print $9}' | sed 's/"//g'`SOURCE_FILE
=`eval "echo $SOURCE_FILE"`echo "
Source file = " ${SOURCE_FILE}###################
#
Data Directory ####################
DATA_DIR
=`echo $*|awk '{print $10}' | sed 's/"//g'`DATA_DIR
=`eval "echo $DATA_DIR"`echo "
Data Dir = " ${DATA_DIR}###################
# Arch
Directory ####################
ARCH_DIR
=`echo $*|awk '{print $11}' | sed 's/"//g'`ARCH_DIR
=`eval "echo $ARCH_DIR"`echo "
Archive Dir = " ${ARCH_DIR}############################
# Environmental variables
. #############################
START_TIME
=`date +%d-%b-%Y" "%H:%M`HOST_NAME
=`uname -n`TSTAMP
=`date '+%Y%m%d%H%M%S'`EXIT_STATUS
='SUCCESS'
BATCH_SOURCE=`echo ${DATA_DIR}/${SOURCE_FILE}`BATCH_TARGET
=`echo ${ARCH_DIR}/${SOURCE_FILE}`
#################################################
#
Move the file ##################################################
mv ${BATCH_SOURCE} ${BATCH_TARGET}
###############
##
Final exit ################
EXIT_STATUS
='SUCCESS'echo "SEASAPAR Status :" $EXIT_STATUSEND_TIME
=`date +%d-%b-%Y" "%H:%M`echo "
Program Completed .... " $END_TIMEecho "Moved ${BATCH_SOURCE}
to ${BATCH_TARGET}"
exit 0 fi

#

No comments:

Post a Comment