You are very close:
Change if statement to
if ssh username@ssh_server '[ -d /directory ]'
I am assuming that you have setup key-based authentication.
You are very close:
Change if statement to
if ssh username@ssh_server '[ -d /directory ]'
I am assuming that you have setup key-based authentication.