Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: CAMEL-656

...

If no username is provided then anonymous login is attempted using no password.
If no port number is provided. Camel will provide default values according to the protocol. (ftp = 21, sftp = 22)

Examples

ftp://someone@someftpserver.com/public/upload/images/holiday2008?password=secret&binary=true
ftp://someoneelse@someotherftpserver.co.uk:12049/reports/2008/budget.txt?password=secret&binary=false&directory=false
ftp://publicftpserver.com/download

...

And the route using Spring DSL:

Code Block
xml
xml

  <route>
     <from uri="ftp://scott@localhost/public/reports?password=tiger&amp;binary=true&amp;consumer.delay=60000"/>
     <to uri="file://target/test-reports"/>
  </route>

Using expression for filenames

In this sample we want to move consumed files to a backup folder using today's date as a sub foldername:. Notice that the move happens on the remote FTP server. If you want to store the downloaded file on your local disk then route it to the File component as the sample above illustrates.

Code Block
java
java
from(ftpUrl + "&expression=backup/${date:now:yyyyMMdd}/${file:name}").to("...");

...