Skip to main content

Fetch files from an SFTP server

Camel has an SFTP component (see Camel documentation) that enables fetching files from an SFTP server. A simple SFTP route for fetching files can look like this:

<routes xmlns="">
  <route id="example.sftp.fa">
    <from uri="sftp://fa@;password=1234&amp;reconnectDelay=10000&amp;delay=60000&amp;disconnect=true&amp;delete=true" />
    <to uri="file:{{back.writable.dir}}/integrations/custom?autoCreate=true" />

The above route:

  • Fetches (copies) files from the SFTP server "" directory (authenticating with username and password, polling once every 60 seconds).

  • Places the files to the /integrations/custom FA directory.

  • Deletes the original files from the SFTP server directory after successful processing.

You might need to apply other SFTP connection parameters as well depending on the requirements of the SFTP server you connect to.