Creating dynamic folder

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating dynamic folder

tamil13

Hi. I want to create dynamic folder in dd-mm-yyyy based on some condition. how can we do?
Below is the sample code.
<choice>
                                <when>
                                        <simple>${file:onlyname.noext} contains ${properties:fileName1} </simple>
                                        <to uri="file:target/${date:now:yyyyMMdd}" />
                                </when>
                                <when>
                                        <simple>${file:onlyname.noext} contains ${properties:fileName2} </simple>
                                        <to uri="file:target/${date:now:yyyyMMdd}" />
                                </when>
                                   .
                                   .

</choice>

but it shows error ${ } placeholders is not allowed. Use the fileName option to set the dynamic expression.
Reply | Threaded
Open this post in threaded view
|

Re: Creating dynamic folder

valdar
The error description explains the solution: "Use the fileName option
to set the dynamic expression."

Use fileName option for the dynamic part like this:

<to
uri=file:/d:/STATIC/PART/?fileName=${date:now:yyyy}/${date:now:MM}/${date:now:dd}/somthing.txt
/>

Andrea.


On Thu, Jan 10, 2013 at 1:30 PM, tamil13 <[hidden email]> wrote:

>
> Hi. I want to create dynamic folder in dd-mm-yyyy based on some condition.
> how can we do?
> Below is the sample code.
> <choice>
>                                 <when>
>                                         <simple>${file:onlyname.noext}
> contains ${properties:fileName1}
> </simple>
>                                         <to
> uri="file:target/${date:now:yyyyMMdd}" />
>                                 </when>
>                                 <when>
>                                         <simple>${file:onlyname.noext}
> contains ${properties:fileName2}
> </simple>
>                                         <to
> uri="file:target/${date:now:yyyyMMdd}" />
>                                 </when>
>                                    .
>                                    .
>
> </choice>
>
> but it shows error ${ } placeholders is not allowed. Use the fileName
> option
> to set the dynamic expression.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Creating-dynamic-folder-tp5725259.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--
"In a world without walls and fences who needs Windows and Gates?"
Reply | Threaded
Open this post in threaded view
|

Re: Creating dynamic folder

tamil13
Thank you very much. I owe you a lot.. It is working like a charm :-)