camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: File component consumer to consume files by timestamp based
Date Tue, 01 Oct 2013 06:36:00 GMT
You can check if its a file or directory, and then always accept
directories, and then only file the timestamp on files.

There is a file.isDirectory() you can use.

On Tue, Oct 1, 2013 at 2:48 AM, rrajen2 <rrajendran@capario.com> wrote:
> Thx Claus.
>
> In the i/p file directory structure data/report/infolder ,it has several zip
> files underneath it. Say when one of the zip file gets modified, the
> infolder directory timestamp also accordingly gets modified.
> So lets say there are 5 zip files in the infolder which was modified 1hr or
> more and 1 zip file in the infolder which is modified within the 1 hr. What
> I am expecting is a list of the 5 zip files. But based on my below
> implementation I don't get any files since the infolder's timestamp has
> undergone change within the 1 hr and is getting excluded out completely.
> Could you please advice on how to solve it, Below is my file component
> consumer implemenation and its associated filter
>
> from("file:data/report?noop=true&recursive=true&delay=3600000&filter=MyFileFilter")
> ......
> ......
>
> Below is my MyFileFilter
> public class MyFileFilter<T> implements GenericFileFilter<T>
> {
>     public boolean accept (GenericFile<T> file)
>     {
>       long lModified=file.getLastModified();
>       long onehourBefoTime= (System.currentTimeMillis()-3600*1000);
>       if (onehourBefoTime-lModified>=0) return true;
>       return false;
>     }
> }
>
> Thanks
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/File-component-consumer-to-consume-files-by-timestamp-based-tp5740319p5740622.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message