Lucifer
Lucifer

Reputation: 842

Moving Multiple file from one folder to another based on filename - camel

I have one requirement, where I need to move multiple files present in one folder to another. This should be done based on filename which should be dynamic.

As Far I have tried out pollenrich and file (antInclude) but in both case I got struck.

<route id="readFile" autoStartup="true">
    <from uri="timer://timer1?repeatCount=1"/>
    <setHeader headerName="xxx">
       <simple>1234</simple>
    </setHeader>
    <pollEnrich timeout="15000">
        <simple>file://{{baseDirectory}}?move={{destinationDirectory}}&amp;antInclude=*_${header.xxx}.txt</simple>
    </pollEnrich>
</route>

Note: Header value will be dynamic, using javascript will pull that data and set it in header. Any help on this would most welcome.

Upvotes: 4

Views: 707

Answers (1)

Lucifer
Lucifer

Reputation: 842

Thank you for all your response,

I achieved it by using pollenrich but tweaking something in pollenrich.

  1. Got CamelBatchsize using pollenrich.
  2. Running into a loop using size.
  3. Using the above code used to move the file. I achieved it.

Thanks.

Upvotes: 2

Related Questions