Hi There is a getLastModified method on the generic file instance, you can use in the filter. You can use that to check if its 1 hour old.
Just google how to check file last modified in standard java to see how to implement such logic. On Sat, Sep 28, 2013 at 2:40 AM, rrajen2 <[email protected]> wrote: > Hi > My requirements for the file component consumer is to just get list of > filenames from a directory that have last modified timestamp which is 1 hr > and greater and append the list of files to a file say data/outputlist.txt. > How would I do that? Could you plz advice? > > The pseudo code that I have so far is > Route1://create a data/outputlist.txt containing list of files that are 1 hr > and greater in the data/report directory. > > from("file:data/report?noop=true&recursive=true&delay=3600000&filter=MyFileFilter") > .processor(Exchange e) > { > exchange.getIn().setBody(${CamelFileAbsolutePath}); > } > > .to("file:data/outputlist.txt?doneFileName=${file:name}.done&fileExist=Append"); > Route2: //this route actually has to email the data/outputlist.txt file > after its completely done by Route1 and delete the file. > > from("file:data/outputlist.txt?doneFileName=${file:name}.done&delay=3400000} > .... //where i email the outputlist.txt file after it is completely > done and finally delete the outputlist.txt > > > The MyFilter is my custom filter that I am intending to do similar to the > below: > public class MyFileFilter<T> implements GenericFileFilter<T> { > public boolean accept(GenericFile<T> file) { > // we want all directories > if (file.isDirectory()) { > return true; > } > // we dont accept any files starting with skip in the name > return !file.getFileName().startsWith("skip"); > } > } > But I don't know how in the MyFileFilter I could filter based on the > timestamp? > > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/File-component-consumer-to-consume-files-by-timestamp-based-tp5740319.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. Email: [email protected] Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
