public static Result pathExists(String path, boolean sudo) throws IOException, InterruptedException {
    String[] command = {
        (WINDOWS) ? "dir" : "/bin/ls",
        path
    };

    return runCommand(command, null, null, sudo);
  }
Test if a file or directory exists

@param path the path to test
@param sudo true to execute the command using sudo (ambari-sudo); otherwise false
@return the shell command result, success indicates the file or directory exists
@throws IOException
@throws InterruptedException
ambari-server/src/main/java/org/apache/ambari/server/utils/ShellCommandUtil.java