Version will full data checking:
#!/bin/bash
function readVal(){
while true; do
echo -n "$1"
read val
[ -n "$2" ] && [ -z "$val" ] && val="$2" && break;
if eval "$3"; then
break;
fi
eval echo "$4"
done
}
echo "ncp v1.0 by rumi"
readVal "Are you copying entire directory/folder? (y/N) " "n" '[[ "$val" =~ y|n|Y|N ]]' 'Put y or n.'
case "$val" in
Y|y)
readVal "Enter source directory : " "" '[ -d "$val" ]' 'Directory \"$val\" does not exist. Try again.'
params="-r $val"
;;
N|n)
i=1
while true; do
readVal "Enter source file$i : " "_" '[ -f "$val" ]' 'File \"$val\" does not exist. Try again.'
case "$val" in
"_")
break;
;;
*)
params="$params \"$val\""
i=$(($i+1))
;;
esac
done
;;
esac
readVal "Enter destination drive & folder (eg: /c/temp format) : " "" '[[ "$val" =~ /./.* ]]' 'Format should be \"/c/temp\". Try again.'
echo "performing scp -P2222 $params administrator@localhost:$val..."
scp -P2222 $params administrator@localhost:$val
rgds
rumi