2

I am using this to download the file from remote server but could you guide how can I use one command to first download and then remove the file from server.

sshpass -p password123 sftp [email protected]:/Complete2/Database.bak /home/user/.docker/appdata/mssql/backup/Database.bak

Thank you

1 Answer 1

2

sftp usually accepts commands interactively. The download and the remove are separate. We can make bash automate that:

sshpass -p password123 sftp [email protected] << EOF
get /Complete2/Database.bak /home/user/.docker/appdata/mssql/backup/Database.bak
rm /Complete2/Database.bak
EOF
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .