I have a polling route for FTP like this
from("sftp://sftpUsername@ftpServer/path/to/folder?password=sftpPassword
&delay=60000&stepwise=false&move=/home/username/processed/$simple{date:now:yyyy}
/$simple{date:now:MM}/$simple{date:now:dd}/${file:name}&binary=true")
.to("file:///tmp/")
The polling is working as expected. I was able to move the processed files to a sub folder inside the /path/to/folder. However, when I tried to move it to a different folder location. I'm getting an exception. Unfortunately, the exception is not detailed.
DEBUG org.apache.camel.component.file.GenericFileOnCompletion - Done processing file: RemoteFile[/path/to/folder/fileName.zip] using exchange: Exchange[fileName.zip] DEBUG org.apache.camel.component.file.remote.FtpOperations - Deleting file: /home/username/processed/2017/07/11/fileName.zip TRACE org.apache.camel.component.file.remote.FtpOperations - Client deleteFile: /home/username/processed/2017/07/11/fileName.zip TRACE org.apache.camel.component.file.remote.FtpOperations - buildDirectory(/home/username/processed/2017/07/11) TRACE org.apache.camel.component.file.remote.FtpOperations - changeCurrentDirectory(/home/username) TRACE org.apache.camel.component.file.remote.FtpOperations - Changing directory: /home/username DEBUG org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy - Renaming file: RemoteFile[/path/to/folder/fileName.zip] to: RemoteFile[/home/username/processed/2017/07/11/fileName.zip] DEBUG org.apache.camel.component.file.remote.FtpOperations - Renaming file: /path/to/folder/fileName.zip to: /home/username/processed/2017/07/11/fileName.zip WARN org.apache.camel.component.file.GenericFileOnCompletion - Error during commit. Exchange[fileName.zip]. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Cannot rename file: RemoteFile[/path/to/folder/fileName.zip] to: RemoteFile[//home/username/processed/2017/07/11/fileName.zip]] org.apache.camel.component.file.GenericFileOperationFailedException: Cannot rename file: RemoteFile[/path/to/folder/fileName.zip] to: RemoteFile[/home/username/processed/2017/07/11/fileName.zip] at org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:115)
I'm using Camel-FTP 2.13.4 which uses commons.net-3.3.jar. I could see that it is trying to do RNFR and RNTO command. I was not able to use those command from command line FTP protocol.
If I understand correctly we can use absolute paths in 2.13.4 version. Please let me know, if this understanding is incorrect.
Thanks in advance for any help in the right direction.
This didn't work as the partition is different and we cannot move a file between partitions. The option is to either move the file to a location in the same partition. Or you could manually FTP it back to a location on different partition.