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: Traverse FTP tree
Date Mon, 09 Sep 2013 15:39:55 GMT
Hi

Yeah you can do this with the camel ftp component.

You need to set recursive=true to travel down the sub dirs.
Then you can use a custom filter to skip the unwanted directories. Or
use some include/exclude to match file names / directory names.

Or use the maxDepth to avoid traveling down to far in the dirs etc.

So there is plenty of options to configure this. See
http://camel.apache.org/file2.html
http://camel.apache.org/ftp2

Notice the options on ftp is inherited from the file component. So
read both links.

You can then use move to move the original file.
The move option use the file language:
http://camel.apache.org/file-language.html

So something alike

move=${file:parent}_${file:onlyname}



On Thu, Sep 5, 2013 at 7:46 PM, Tom.Fornoville <tom.fornoville@roots.be> wrote:
> Hi everyone,
>
> On our ftp server we have a home directory for every customer where they can
> put their files, it look something like this:
>
> ftp-root
>   -- 001
>       -- 20130905.xml
>       -- feedback
>           -- feedback_20130903.xml
>           -- feedback_20130904.xml
>   -- 002
>       -- 20130905.xml
>       -- feedback
>           -- feedback_20130901.xml
> ...
>
> Every hour we need to:
>
>  1) go into every customer directory (001, 002, ...) and check for files
> while skipping subdirectories like the feedback subdirectories in the
> structure above
>
>  2) rename the file: 20130905.xml for customer 001 should become
> 001_20130905.xml and so on
>
>  3) delete the original file from the ftp (I think this can be done by
> specifying delete=true)
>
> If someone can put us on the right track for configuring the neccessary
> routes and endpoints it would be appreciated.
>
> Cheers,
> Tom
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Traverse-FTP-tree-tp5738803.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