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