当前位置: 首页 > 知识库问答 >
问题:

我们可以使用apache camelendpoint将文件从FTP服务器移动到本地目录吗?

巴星华
2023-03-14

我想知道是否可以使用apache camelendpoint属性将文件从FTP服务器移动或下载到本地目录?

sftp:/user@ftp.com/outgoingfolder?password=*****&throwexceptiononconnectfailed=true&maximumreconnectactitts=0&stepwise=false&fastexistscheck=true&disconnect=true&consumer.delay=300000&passivemode=true

我使用“&move=C:\folder”作为属性,但它不起作用,我得到以下错误

WARN - [SftpConsumer:213] Consumer Consumer[sftp://user@ftp.com/outgoingFolder?consumer.delay=300000&disconnect=true&fastExistsCheck=true&maximumReconnectAttempts=0&move=C%3A%5C%5Cfolders&passiveMode=true&password=xxxxxx&stepwise=false&throwExceptionOnConnectFailed=true] failed polling endpoint: Endpoint[sftp://user@ftp.com/outgoingFolder?consumer.delay=300000&disconnect=true&fastExistsCheck=true&maximumReconnectAttempts=0&move=C%3A%5C%5Cfolder&passiveMode=true&password=xxxxxx&stepwise=false&throwExceptionOnConnectFailed=true]. Will try again at next poll. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Cannot list directory:outgoingFolder]org.apache.camel.component.file.GenericFileOperationFailedException: Cannot list directory: outgoingFolder        at org.apache.camel.component.file.remote.SftpOperations.listFiles(SftpOperations.java:617)        at org.apache.camel.component.file.remote.SftpConsumer.doPollDirectory(SftpConsumer.java:117)        at org.apache.camel.component.file.remote.SftpConsumer.pollDirectory(SftpConsumer.java:79)        at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:131)        at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175)        at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102)        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)        at java.lang.Thread.run(Thread.java:745)Caused by: 4:        at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2208)        at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2215)        at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1565)        at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1526)        at org.apache.camel.component.file.remote.SftpOperations.listFiles(SftpOperations.java:608)        ... 12 more Caused by: java.io.IOException: inputstream is losed        at com.jcraft.jsch.ChannelSftp.fill(ChannelSftp.java:2884)        at com.jcraft.jsch.ChannelSftp.header(ChannelSftp.java:2908)        at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2189)        ... 16 more

共有1个答案

鲍高扬
2023-03-14

No,&move选项用于在远程文件系统的范围内移动文件。

请改用以下方式:

from("sftp://user@ftp.com/outgoingFolder?password=*****&throwExceptionOnConnectFailed=true&maximumReconnectAttempts=0&stepwise=false&fastExistsCheck=true&disconnect=true&consumer.delay=300000&passiveMode=true")
.to("file:C:\\folder");
 类似资料:
  • 我遇到了以下场景 将文件从FTP服务器下载到本地并进行处理 例如:FTPSERVER/dir/file_name= < li >处理后,将FTP服务器中的文件移动到其存档文件夹中 例如:FTPSERVER/dir/file_name= 我必须使用shell脚本来完成这项工作。我已经完成了第一部分使用 ncftpget -u $USER -p $PASS $HOST/DIR/$FILENAME 我不

  • 问题内容: 我正在使用JSch在由GWT制作的网站中连接到SFTP。我读过的一个小例子,, 但是我没有找到将文件从远程服务器目录复制到远程服务器目录的解决方案。 例如,我要将文件从复制到。文件名= 。 我在这里呆了几个小时,因为大多数网络解决方案都是将文件从远程服务器获取到本地,或者将文件从本地上传到远程服务器。 假设存在于 我上传在。 现在,我想移动到并删除在。 我该怎么办? 问题答案: 似乎需

  • 我正在尝试将FTP服务器上的多个文件移动到同一服务器上的不同目录。到目前为止,我已经编写了一个bash脚本,该脚本将登录并检索远程目录中的任何新文件,但ftp命令不支持“mv”命令。本质上,该脚本将下载新文件,然后在下载后将文件移动到同一服务器上的不同目录。请注意,每次文件名都会不同,因此通配符的使用很重要。 在你回答之前,请注意这需要自动化,所以使用像Filezilla这样的GUI对我没有帮助,

  • 我想复制文件到。我不熟悉linux和jsch,所以请指导我在dir中复制上面的文件。我尝试了以下代码,但它不适合我。

  • 我需要将文件从远程服务器复制到本地服务器,然后使用JMETER使用SSH SFTP进行尝试。我提供了登录凭据,并在“文件传输”部分中,选择了操作 - PUT源路径 - 远程路径( /ftp / xxx / yyy)目标 - 本地路径。 收到错误为` Java . io . file not found exception:C:\ Apache-jmeter-5 . 1 . 1 \ bin \ FT

  • 在过去的几个小时里,我一直在努力解决这个问题,如果不再次下载和上传文件,我真的找不到一个方法来解决这个问题。有可能吗? 这个问题类似于这个问题:我如何使用FTP在目录之间移动文件?但我有一种感觉,它没有解决,尽管它得到了回答。 重命名文件本身非常简单,没有任何问题,但是我如何将其移动到另一个目录? 我有以下示例代码: 我得到了与另一个主题相同的错误: