Milleniumlegend
IS-IT--Management
- Dec 16, 2003
- 135
The following is the script that I am trying to run but for some reason it gives me an error when the dir = "int" part executes. I am running the script from the same server and I have two different environment. I have read access to the source directory and would like to copy those files to the destination directory where I am running the script from. Could someone please see if I am missing something here.
Many thanks
# Source and Destination folders.
srcbin=/d2/share/qa/bin
srcint=/d2/share/qa/int
destint=/d2/share/m1/int
destbin=/d2/share/m1/bin
filename=$1
#echo $filename
if [ $# -ne 1 ] ; then
echo "Invalid Arguments: Usage: getcm.ksh <FILENAME.EXT>"
exit 1
fi
# Strip the extension for the file.
filename=`echo "${filename%\.*}"`
#echo $filename
for dir in bin int
do
if [ "$dir" = "bin" ]
then
for ext in lst gnt
do
cp -p "$srcbin/$filename.$ext" $destbin
echo "Exit status = $?"
if [ $? -ne 0 ]
then
echo "Unable to copy $filename.$ext to $destbin"
exit 1
fi
done
fi
if [ "$dir" = "int" ] ; then
for ext in lst int idy cbl
do
cp -p "$srcbin/$filename.$ext" $destint
if [ $? -ne 0 ]
then
echo "Unable to copy $filename.$ext to $destint"
exit 1
fi
done
fi
done
Many thanks
# Source and Destination folders.
srcbin=/d2/share/qa/bin
srcint=/d2/share/qa/int
destint=/d2/share/m1/int
destbin=/d2/share/m1/bin
filename=$1
#echo $filename
if [ $# -ne 1 ] ; then
echo "Invalid Arguments: Usage: getcm.ksh <FILENAME.EXT>"
exit 1
fi
# Strip the extension for the file.
filename=`echo "${filename%\.*}"`
#echo $filename
for dir in bin int
do
if [ "$dir" = "bin" ]
then
for ext in lst gnt
do
cp -p "$srcbin/$filename.$ext" $destbin
echo "Exit status = $?"
if [ $? -ne 0 ]
then
echo "Unable to copy $filename.$ext to $destbin"
exit 1
fi
done
fi
if [ "$dir" = "int" ] ; then
for ext in lst int idy cbl
do
cp -p "$srcbin/$filename.$ext" $destint
if [ $? -ne 0 ]
then
echo "Unable to copy $filename.$ext to $destint"
exit 1
fi
done
fi
done