public static Result mkdir(String directoryPath, boolean sudo) throws IOException, InterruptedException {

    // If this directory already exists, do not try to create it
    if (pathExists(directoryPath, sudo).isSuccessful()) {
      return new Result(0, "The directory already exists, skipping.", ""); // Success!
    } else {
      ArrayList<String> command = new ArrayList<>();

      command.add("/bin/mkdir");

      if (!WINDOWS) {
        command.add("-p"); // create parent directories
      }

      command.add(directoryPath);

      return runCommand(command, null, null, sudo);
    }
  }
Creates the specified directory and any directories in the path

@param directoryPath the directory to create
@param sudo          true to execute the command using sudo (ambari-sudo); otherwise false
@return the shell command result
ambari-server/src/main/java/org/apache/ambari/server/utils/ShellCommandUtil.java