code: public void mkdirs(String path, int posixPermission) throws IOException {
          SFTPv3FileAttributes atts = _stat(path);
          if (atts!=null && atts.isDirectory())
              return;
  
          int idx = path.lastIndexOf('/');
          if (idx>0)
              mkdirs(path.substring(0,idx), posixPermission);
  
          try {
              mkdir(path, posixPermission);
          } catch (IOException e) {
              throw new IOException("Failed to mkdir "+path,e);
          }
      }
docs: Makes sure that the directory exists, by creating it if necessary.
  @param path directory path.
  @param posixPermission POSIX permissions.
  @throws IOException if it is not possible to access to the directory.