docs: public static String getPathPart(String resource, int level) {
  
          resource = getFolderPath(resource);
          String result = null;
          int pos = 0, count = 0;
          if (level >= 0) {
              // Walk down from the root folder /
              while ((count < level) && (pos > -1)) {
                  count++;
                  pos = resource.indexOf('/', pos + 1);
              }
          } else {
              // Walk up from the current folder
              pos = resource.length();
              while ((count > level) && (pos > -1)) {
                  count--;
                  pos = resource.lastIndexOf('/', pos - 1);
              }
          }
          if (pos > -1) {
              // To many levels walked
              result = resource.substring(0, pos + 1);
          } else {
              // Add trailing slash
              result = (level < 0) ? "/" : resource;
          }
          return result;
      }