Home > Mobile >  What 'filterDirectory' of Camel File component does?
What 'filterDirectory' of Camel File component does?

Time:09-30

I wonder what is the purpose of 'filterDirectory' parameter in Camel File component. I didn't managed to find any examples with this property. According to docs:

Filters the directory based on Simple language. For example to filter on current date, you can use a simple date pattern such as ${date:now:yyyMMdd}.

I wrote some sample route to check it behaviour:

public class FilterDirectoryRoute extends RouteBuilder {

private static final String FILE = "file:";
private static final String START_DIR = "C:/test/camel/filterDirectoryRoute";

private final Map<String, String> params = Map.of(
  "noop", "true",
  "recursive", "true",
  "filterDirectory", "${date:now:yyyy/DDD}"
);

@Override
public void configure() {

from(FILE   START_DIR   fileParams(params))
    .log(DEBUG, log, "date = ${date:now:yyyy/DDD}")
    .log(DEBUG, log, "body = ${body}")
    .end();
  }
}

There is next structure of filterDirectoryRoute directory:

           
  • Related