Without test for host online or other logic to see if backup was successful, the rename code would rename the host folder as the filename variable is blank