Shashikant shah

Tuesday, 6 October 2015

Script for copy data

#!/bin/bash

Souce_path=$1
Dest_path=$2

if [[ "$Souce_path" == '' ]] || [[ "$Dest_path" == '' ]];then
    echo "Source or Destination path can not be empty.";
    exit 0
fi

run=$(cp -rf $Source_path $Dest_path 2> /tmp/err)
input=$?
   
    if [ "$input" = = 0 ];then
    echo "Successfuly copied Directory and File."
else
    echo "Do not copy Directory and File."
exit 2
fi
=====================
# ./script  /shashi/test.txt   /test/

No comments:

Post a Comment