cdm/src/main/java/thredds/inventory/MFileCollectionManager.java
public void addDirectoryScan(String dirName, String suffix, String regexpPatternString, String subdirsS, String olderS, Object auxInfo) {
    CompositeMFileFilter filters = new CompositeMFileFilter();
    if (null != regexpPatternString)
      filters.addIncludeFilter(new RegExpMatchOnName(regexpPatternString));
    else if (suffix != null)
      filters.addIncludeFilter(new WildcardMatchOnPath("*" + suffix + "$"));

    if (olderS != null) {
      try {
        TimeDuration tu = new TimeDuration(olderS);
        filters.addAndFilter(new LastModifiedLimit((long) (1000 * tu.getValueInSeconds())));
      } catch (Exception e) {
        logger.error(collectionName + ": Invalid time unit for olderThan = {}", olderS);
      }
    }

    boolean wantSubdirs = true;
    if ((subdirsS != null) && subdirsS.equalsIgnoreCase("false"))
      wantSubdirs = false;

    CollectionConfig mc = new CollectionConfig(dirName, dirName, wantSubdirs, filters, auxInfo);

    // create name
    StringBuilder sb = new StringBuilder(dirName);
    if (wantSubdirs)
      sb.append("**/");
    if (null != regexpPatternString)
      sb.append(regexpPatternString);
    else if (suffix != null)
      sb.append(suffix);
    else
      sb.append("noFilter");

    collectionName = sb.toString();
    scanList.add(mc);
  }
public void addDirectoryScan(String dirName, String suffix, String regexpPatternString, String subdirsS, String olderS, Object auxInfo) {
    CompositeMFileFilter filters = new CompositeMFileFilter();
    if (null != regexpPatternString)
      filters.addIncludeFilter(new RegExpMatchOnName(regexpPatternString));
    else if (suffix != null)
      filters.addIncludeFilter(new WildcardMatchOnPath("*" + suffix + "$"));

    if (olderS != null) {
      try {
        TimeDuration tu = new TimeDuration(olderS);
        filters.addAndFilter(new LastModifiedLimit((long) (1000 * tu.getValueInSeconds())));
      } catch (Exception e) {
        logger.error(collectionName + ": Invalid time unit for olderThan = {}", olderS);
      }
    }

    boolean wantSubdirs = true;
    if ((subdirsS != null) && subdirsS.equalsIgnoreCase("false"))
      wantSubdirs = false;

    CollectionConfig mc = new CollectionConfig(dirName, dirName, wantSubdirs, filters, auxInfo);

    // create name
    StringBuilder sb = new StringBuilder(dirName);
    if (wantSubdirs)
      sb.append("**/");
    if (null != regexpPatternString)
      sb.append(regexpPatternString);
    else if (suffix != null)
      sb.append(suffix);
    else
      sb.append("noFilter");

    collectionName = sb.toString();
    scanList.add(mc);
  }
public void addDirectoryScan ( String dirName , String suffix , String regexpPatternString , String subdirsS , String olderS , Object auxInfo ) { CompositeMFileFilter filters = new CompositeMFileFilter ( ) ; if ( null != regexpPatternString ) filters . addIncludeFilter ( new RegExpMatchOnName ( regexpPatternString ) ) ; else if ( suffix != null ) filters . addIncludeFilter ( new WildcardMatchOnPath ( "*" + suffix + "$" ) ) ; if ( olderS != null ) { try { TimeDuration tu = new TimeDuration ( olderS ) ; filters . addAndFilter ( new LastModifiedLimit ( ( long ) ( 1000 * tu . getValueInSeconds ( ) ) ) ) ; } catch ( Exception e ) { logger . error ( collectionName + ": Invalid time unit for olderThan = {}" , olderS ) ; } } boolean wantSubdirs = true ; if ( ( subdirsS != null ) && subdirsS . equalsIgnoreCase ( "false" ) ) wantSubdirs = false ; CollectionConfig mc = new CollectionConfig ( dirName , dirName , wantSubdirs , filters , auxInfo ) ; // create name
 StringBuilder sb = new StringBuilder ( dirName ) ; if ( wantSubdirs ) sb . append ( "**/" ) ; if ( null != regexpPatternString ) sb . append ( regexpPatternString ) ; else if ( suffix != null ) sb . append ( suffix ) ; else sb . append ( "noFilter" ) ; collectionName = sb . toString ( ) ; scanList . add ( mc ) ; }
Add a directory scan to the collection

@param dirName             scan this directory
@param suffix              require this suffix (overriddden by regexp), may be null
@param regexpPatternString if present, use this reqular expression to filter files , may be null
@param subdirsS            if "true", descend into subdirectories, may be null
@param olderS              udunit time unit - files must be older than this amount of time (now - lastModified > olderTime), may be null
// * @param dateFormatString dateFormatMark string, may be null
@param auxInfo             attach this object to any MFile found by this scan
Add a directory scan to the collection