如何重新命名和移动一次由骆驼处理的FTP文件? [英] How to rename and move the file on FTP once processed by camel?

查看:162
本文介绍了如何重新命名和移动一次由骆驼处理的FTP文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的ftp上有好几个文件夹:

I have several folders on my ftp:

/csv
/xml
/processed
/....

如何重命名并移动每个文件从file.csv到file.done并将其移至已处理的文件夹?
我已经尝试了很多选项,比如向from添加大量参数,或者在onCompletion中添加一些内容或为移动文件添加更多路径。
所有占位符都包含正确的值,并由Spring处理。


How can I rename and move each file once it has been processed from file.csv to file.done and move it to processed folder ? I have tried many options like adding tons of parameters to "from" or add something into onCompletion or adding several more routes for just moving files. All placeholders contain correct values and are processed by Spring.

<route>
            <from uri="ftp://{{ftp.user}}@{{ftp.server}}/{{inbound.csv}}?password={{ftp.pass}}&amp;binary=true&amp;include=.*csv"/>
            <onCompletion onCompleteOnly="true">
                <to uri="ftp://{{ftp.user}}@{{ftp.server}}/{{outbound.csv}}?password={{ftp.pass}}&amp;doneFileName=${file:name}.done"/>
            </onCompletion>
            <delay>
                <constant>15000</constant>
            </delay>
            <unmarshal><csv/></unmarshal>
            <to uri="bean:cSVHandler?method=process"/>
        </route>

请帮忙。

推荐答案

使用移动选项将移动/重命名处理后的文件,

Use the move option which will move/rename the file after its processed,

<from uri="ftp://{{ftp.user}}@{{ftp.server}}/{{inbound.csv}}
      ?password={{ftp.pass}}&amp;binary=true&amp;include=.*csv
      &amp;move=../processed"/>

将文件移动到../processed目录中。

Which will move the file into the ../processed directory.

http://camel.apache.org/file2

这篇关于如何重新命名和移动一次由骆驼处理的FTP文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆