我的 ftp 上有几个文件夹:
/csv/xml/处理/....如何将每个文件从 file.csv 处理到 file.done 并将其移动到已处理文件夹后重命名和移动?我已经尝试了很多选项,比如向from"添加大量参数,或者在 onCompletion 中添加一些东西,或者添加更多的路由来移动文件.所有占位符都包含正确的值并由 Spring 处理.
<路线><from uri="ftp://{{ftp.user}}@{{ftp.server}}/{{inbound.csv}}?password={{ftp.pass}}&binary=true&include=.*csv"/><onCompletion onCompleteOnly="true"><to uri="ftp://{{ftp.user}}@{{ftp.server}}/{{outbound.csv}}?password={{ftp.pass}}&doneFileName=${文件:名称}.done"/></onCompletion><延迟><常数>15000</常数></延迟><unmarshal><csv/></unmarshal><to uri="bean:cSVHandler?method=process"/></路线>请帮忙.
解决方案使用移动选项,在处理完文件后移动/重命名文件,
<from uri="ftp://{{ftp.user}}@{{ftp.server}}/{{inbound.csv}}?password={{ftp.pass}}&binary=true&include=.*csv&move=../已处理"/>这会将文件移动到 ../processed 目录中.
在 camel.apache/file2 上查看有关移动选项的更多详细信息/p>
I have several folders on my ftp:
/csv /xml /processed /....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}}&binary=true&include=.*csv"/> <onCompletion onCompleteOnly="true"> <to uri="ftp://{{ftp.user}}@{{ftp.server}}/{{outbound.csv}}?password={{ftp.pass}}&doneFileName=${file:name}.done"/> </onCompletion> <delay> <constant>15000</constant> </delay> <unmarshal><csv/></unmarshal> <to uri="bean:cSVHandler?method=process"/> </route>Please help.
解决方案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}}&binary=true&include=.*csv &move=../processed"/>Which will move the file into the ../processed directory.
See more details about the move option at camel.apache/file2
更多推荐
骆驼处理后如何重命名和移动FTP上的文件?
发布评论