Delete remote dir and transfer replacement dir from local

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.