How to check If Path Exists Using Fabric2.x

You can execute the test command remotely with the -d option to test if the file exist and is a directory while passing the warn parameter to the run method so the execution doesn't stop in case of a non-zero exit status code. Then the value failed on the result will be True in case that the folder doesn't exist and False otherwise.

folder = '/path/to/folder'
if c.run('test -d {}'.format(folder), warn=True).failed:
    # Folder doesn't exist
    c.run('mkdir {}'.format(folder))