javaapache-camelspring-camelcamel-ftp

How do I specify the directory path correctly for an SFTP server?


I have the /test directory by this path on the SFTP server - /out/test (root directory -> /test). I set this path in the SFTP URL for my application - sftp://username@host.com:22/out/test?fileName=file.txt, but it throws an exception:

Cannot change directory to: test

I know that my directory is a subfolder for the root directory, but looks like Apache Camel ignores this path in the URL (DSL in my code) and go to the /home/{username} and as result can't find this folder in /home, because it doesn't exist here. Maybe I didn't specify the URL correctly (maybe I should do something like this //)?

I tried this solution, but it didn't help:


Solution

  • What version of Camel do you use?

    There is no support for absolute paths (as its security problem and also dont work on all FTP servers) in newer Camel versions. You can on the FTP server have symlinks or whatnot to make the user jump to any folder you like (configure user accessibility on the FTP sever).