Apache Camel SFTP file download from specific directory

2.3k views Asked by At

I used FTP component of camel but it could not download the files that I want.

<camel:endpoint id="ftpNotificationDownload" uri="sftp:/11.1.1.1://app/as?username=aa&amp;password=1111&amp;fastExistsCheck=true&amp;localWorkDirectory=C:\\asd&amp;download=true&amp;throwExceptionOnConnectFailed=true&amp;delay=4000&amp;useFixedDelay=true"/>

I want all the files and folders to be downloaded under my local folder so I did not put filename option.

When I give the host name as 11.1.1.1, it works but when I set directory after host name like 11.1.1.1:/app/directory, it does not work.

I have checked SFTP server and it is up.

1

There are 1 answers

0
Martin Prikryl On BEST ANSWER

There should not be a colon (:) after the host name in the uri. And probably not even one of the two slashes. On the other hand, you are missing one slash after the sftp:.

See Apache Camels URIs syntax.

sftp://[username@]hostName[:port]/directoryName[?options]

Try

sftp://11.1.1.1/app/as?...

Note that this is true for any URI, not just Camel.