#!/bin/sh
#!/usr/bin/expect -f

if [ $# -lt 7 ]
then
    echo "Usage : `basename $0` [IP] [ID] [PASSWD] [SRC] [DEST] [FILE] [PORT]"
    exit
fi

MACHINE=$1
USER=$2
PASSWD=$3
SRC_PATH=$4
DST_PATH=$5
FILE=$6
#UPLOAD_FILE=$7
PORT=$7
BAK_FILE=$FILE.`date +%m%d`

cd $DST_PATH

export SSHPASS=$PASSWD
#sshpass -p $PASSWD ssh -o StrictHostKeyChecking=no $USER@$MACHINE <<EndFTP

#	scp $USER@$MACHINE:$DST_PATH/$FILE $SRC_PATH

#EndFTP

sshpass -e sftp -o StrictHostKeyChecking=no -oBatchMode=no -b - $USER@$MACHINE <<EndFTP

	cd $SRC_PATH
	put $FILE
	bye

EndFTP

#mv $DST_PATH/$FILE $DST_PATH/$UPLOAD_FILE
