def remote_dir_exists(dir): with quiet(): dir_exists = run('test -d {}'.format(dir)).succeeded return dir_exists