FTP Connector - Mule 4

Support Category: Select

FTP Connector v1.5

Anypoint Connector for FTP (FTP Connector) provides access to files and folders on an FTP server. Its main features include:

  • The ability to read files or fully list directory contents on demand.

  • Support for common FTP operations such as creating directories and copying, moving, renaming, and deleting files.

  • Support for locking files.

  • File matching functionality.

  • A design that is fully consistent with the File and SFTP connectors. The same set of operations is available on all these connectors, and they behave similarly.

Connect to an FTP Server

You can set up a connection through an ftp:config element, for example:

<ftp:config name="ftp">
  <ftp:connection
    username="anonymous"
    password="password"
    host="localhost"
    port="${ftpPort}"
    workingDir="${workingDir}"/>
</ftp:config>

The workingDir provides the path to a directory that is treated as the root of every relative path used with this connector. If the directory is not provided, the remote server’s default serves as the working directory. The username, password, host, and port attributes are self explanatory.

Representation

Mule 4 provides a message structure utilizing a pair of payload and attributes. While the payload is the same as Mule 3, in Mule 4 the data moves around. This means that the payload is a file’s content. The attributes provide an object that contains metadata on the payload and information such as the file’s name, path, size, timestamps, etc. For the FTP and SFTP connectors these attributes are known as the file attributes.

The Mule message contains the concepts of encoding and MIME type. These are used to describe the format in which a payload is represented. The file attributes describe a file’s encoding and MIME type.