0

I have a remote VM (Ubuntu 18) that will be used in production.

ssh keys are discouraged, so I transfer files using scp.

I want a script that does two things.

  1. deletes a directory from the remote VM (For which I can use ssh)

  2. transfer a directory from local to remote, for which I can use scp.

However, I am not quite sure how to combine the two into one script. If I stay in ssh, then the scp command will be run from the remote box (right?). If I exit ssh, I exit the scrip altogether.

  • 1
    You should have a look at rsync which can delete files and folders in the target and you do not have to delete the directory and copy it over again. – Thomas Mar 26 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.