You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by vishal1981 <vi...@ericsson.com> on 2012/10/09 00:26:38 UTC
File name as (Program|Delta)_YYYYDDMM.zip for File and FTP
consumer?
Hi,
I want to define a FTP consumer such that it consumes files with names such
as, Program_20121008.zip, Delta_20121008.zip etc. i.e. Some filename patter
followed by _ followed by toda's date.
Now if I use the fileName property of the File consumer I can define the
name as Program_${date:now:yyyyMMdd} which is great but what I really want
is a mix of java regex and Camel's File language combined to have something
like,
(program|delta)_${date:now:yyyyMMdd}.zip
If I use this in include then I believe I cannot use the file language and
hence the above expression doesnt work. Include expects a Java style regex
and unfortunately I don't think there is a way in Java to say today's date
as regex.
If I use filename then Camel thinks of the above a File Language expression
and doesn't evaluate (program|delta) part.
Can you guys suggest me how this could be done? I am trying to avoid using
filters as I am expecting users for now to manually enter a filename
regex/Camel file lang expression.
Thanks in advance,
-v-
--
View this message in context: http://camel.465427.n5.nabble.com/File-name-as-Program-Delta-YYYYDDMM-zip-for-File-and-FTP-consumer-tp5720759.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: File name as (Program|Delta)_YYYYDDMM.zip for File and FTP
consumer?
Posted by Willem jiang <wi...@gmail.com>.
Camel has the GenericFileFilter[1] interface that you can use the do this kind of job.
[1]http://camel.apache.org/ftp2.html#FTP2-Filterusing%7B%7Borg.apache.camel.component.file.GenericFileFilter%7D%7D
--
Willem Jiang
Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: willemjiang
On Tuesday, October 9, 2012 at 6:26 AM, vishal1981 wrote:
> Hi,
> I want to define a FTP consumer such that it consumes files with names such
> as, Program_20121008.zip, Delta_20121008.zip etc. i.e. Some filename patter
> followed by _ followed by toda's date.
> Now if I use the fileName property of the File consumer I can define the
> name as Program_${date:now:yyyyMMdd} which is great but what I really want
> is a mix of java regex and Camel's File language combined to have something
> like,
> (program|delta)_${date:now:yyyyMMdd}.zip
> If I use this in include then I believe I cannot use the file language and
> hence the above expression doesnt work. Include expects a Java style regex
> and unfortunately I don't think there is a way in Java to say today's date
> as regex.
> If I use filename then Camel thinks of the above a File Language expression
> and doesn't evaluate (program|delta) part.
>
> Can you guys suggest me how this could be done? I am trying to avoid using
> filters as I am expecting users for now to manually enter a filename
> regex/Camel file lang expression.
>
> Thanks in advance,
> -v-
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/File-name-as-Program-Delta-YYYYDDMM-zip-for-File-and-FTP-consumer-tp5720759.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).