Best practices on how to erase everything in destination deployment folder and restart the app after deployment using Appveyor
So it actually only took one line of code:

1) First take the SSH public key from the settings page inside the appveyor project and make sure you put it into the authorized_keys inside user_that_you_are_going_to_login_with_from_appveyor/.ssh/authorized_keys

2) To clear the folder before deploying to it on a Ubuntu server

before_deploy:    
  ssh user@host -t "rm -r -v /pathtofolder/*;exit; bash --login"


3) Now about the restart of the app I wanted to use after_deploy however there is a problem with that. After deploy fires straight after deploy and doesn't wait untill upload is finished. I wanted to use it to run 

systemctl restart myapp


However the problem seemed to solved itself because systemctl restarted my app at the moment when it was substituted with a new one or maybe at the moment when I call it the first time after the files have been reloaded. So far it seems I have a new app running after I run the script.