骆驼处理后如何重命名和移动FTP上的文件?

编程入门 行业动态 更新时间:2024-10-27 03:40:05
本文介绍了骆驼处理后如何重命名和移动FTP上的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的 ftp 上有几个文件夹:

/csv/xml/处理/....

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

<路线><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=${文件:名称}.done"/></onCompletion><延迟><常数>15000</常数></延迟><unmarshal><csv/></unmarshal><to uri="bean:cSVHandler?method=process"/></路线>

请帮忙.

解决方案

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

<from uri="ftp://{{ftp.user}}@{{ftp.server}}/{{inbound.csv}}?password={{ftp.pass}}&amp;binary=true&amp;include=.*csv&amp;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}}&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>

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}}&amp;binary=true&amp;include=.*csv &amp;move=../processed"/>

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

See more details about the move option at camel.apache/file2

更多推荐

骆驼处理后如何重命名和移动FTP上的文件?

本文发布于:2023-08-01 20:12:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1271341.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:骆驼   重命名   文件   FTP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!