grib/src/main/java/ucar/nc2/grib/collection/GribCdmIndex.java
private static boolean updateLeafCollection(boolean isGrib1, FeatureCollectionConfig config,
                                              CollectionUpdateType updateType, boolean isTop,
                                              Logger logger, Path dirPath) throws IOException {

    if (config.ptype == FeatureCollectionConfig.PartitionType.file) {
      return updateFilePartition(isGrib1, config, updateType, isTop, logger, dirPath);

    } else {
      Formatter errlog = new Formatter();
      CollectionSpecParser specp = config.getCollectionSpecParser(errlog);

      try (DirectoryCollection dcm = new DirectoryCollection(config.collectionName, dirPath, isTop, config.olderThan, logger)) {
        dcm.putAuxInfo(FeatureCollectionConfig.AUX_CONFIG, config);
        if (specp.getFilter() != null)
          dcm.setStreamFilter(new StreamFilter(specp.getFilter(), specp.getFilterOnName()));

        boolean changed = updateGribCollection(isGrib1, dcm, updateType, FeatureCollectionConfig.PartitionType.directory, logger, errlog);
        logger.debug("  GribCdmIndex.updateDirectoryPartition was updated=%s on %s%n", changed, dirPath);
        return changed;
      }
    }

  }
private static boolean updateLeafCollection(boolean isGrib1, FeatureCollectionConfig config,
                                              CollectionUpdateType updateType, boolean isTop,
                                              Logger logger, Path dirPath) throws IOException {

    if (config.ptype == FeatureCollectionConfig.PartitionType.file) {
      return updateFilePartition(isGrib1, config, updateType, isTop, logger, dirPath);

    } else {
      Formatter errlog = new Formatter();
      CollectionSpecParser specp = config.getCollectionSpecParser(errlog);

      try (DirectoryCollection dcm = new DirectoryCollection(config.collectionName, dirPath, isTop, config.olderThan, logger)) {
        dcm.putAuxInfo(FeatureCollectionConfig.AUX_CONFIG, config);
        if (specp.getFilter() != null)
          dcm.setStreamFilter(new StreamFilter(specp.getFilter(), specp.getFilterOnName()));

        boolean changed = updateGribCollection(isGrib1, dcm, updateType, FeatureCollectionConfig.PartitionType.directory, logger, errlog);
        logger.debug("  GribCdmIndex.updateDirectoryPartition was updated=%s on %s%n", changed, dirPath);
        return changed;
      }
    }

  }
Update all the gbx indices in one directory, and the ncx index for that directory

@param config  FeatureCollectionConfig
@param dirPath directory path
@return true if collection was rewritten, exception on failure