I am able get the files from remote to archive good , i want to archive the files to another folder on remote after get , but single file works good with remote and multiple files were there it fails.
Please help.
echo "begin"
port="22"
host_name="host"
sftp_username="user"
sftp_password="password"
FTP_TYPE="$5"
SOURCE_PATH="$6"
DEST_PATH="$7"
FILE_NAME="$8"
echo "File name: ${FILE_NAME}"
echo "SOURCE_PATH: ${SOURCE_PATH}"
echo "DEST_PATH: ${DEST_PATH}"
echo "sftp connection begin"
/usr/bin/expect <<EOF
spawn sftp -C -oPort=$port $sftp_username@$host_name
expect "password:"
expect {
"yes/no" {
send "yes\r";
exp_continue
}
"password"
}
send "$sftp_password\r"
expect "sftp>"
send "cd ${SOURCE_PATH}\r"
expect "sftp>"
send "mget *.csv ${DEST_PATH}\r"
expect "sftp>"
#send "cd /bucket/DEV/PO/EBS2CLD\r"
#expect "sftp>"
#send "rename data/.csv archive/.csv\r"
#expect "sftp>"
send "quit\r"
EOF
echo "Above file(s) transferred from SFTP to Oracle Server"
echo "ftp connection end"
echo "end"
fi
Please help.
echo "begin"
port="22"
host_name="host"
sftp_username="user"
sftp_password="password"
FTP_TYPE="$5"
SOURCE_PATH="$6"
DEST_PATH="$7"
FILE_NAME="$8"
echo "File name: ${FILE_NAME}"
echo "SOURCE_PATH: ${SOURCE_PATH}"
echo "DEST_PATH: ${DEST_PATH}"
echo "sftp connection begin"
/usr/bin/expect <<EOF
spawn sftp -C -oPort=$port $sftp_username@$host_name
expect "password:"
expect {
"yes/no" {
send "yes\r";
exp_continue
}
"password"
}
send "$sftp_password\r"
expect "sftp>"
send "cd ${SOURCE_PATH}\r"
expect "sftp>"
send "mget *.csv ${DEST_PATH}\r"
expect "sftp>"
#send "cd /bucket/DEV/PO/EBS2CLD\r"
#expect "sftp>"
#send "rename data/.csv archive/.csv\r"
#expect "sftp>"
send "quit\r"
EOF
echo "Above file(s) transferred from SFTP to Oracle Server"
echo "ftp connection end"
echo "end"
fi