• We had to restore from a backup today after a failed software update. Backup was from 0000 EDT and restored it at 0800 EDT so we lost about 8hrs. Today is 07/20/2024. More info here.

Archiving Multiple files after SFTP

mahesha

New Member
Joined
Sep 19, 2023
Messages
3
Reaction score
0
Credits
42
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
 



Members online


Top