About the File Connector
Release Notes: File Connector Release Notes
The File connector handles files and folders on a locally mounted file system. 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 four connectors, and they behave almost identically.
The File connector does not always require configuration. However, it is good practice to define one. The most important configuration parameter is the Working Directory (
workingDir), which is the path to a directory that is treated as the root of every relative path that you specify with this connector. If you do not provide a working directory, the connector configuration will default to the value of the
user.home system property. If the system property is not set, the connector will fail to initialize.
You can also set the default encoding to use when writing files. It defaults to Mule runtime’s default encoding. If you use any File connector operations without referencing a configuration, the operation will use the default values.
This example sets a working directory for the File connector:
1 2 3 <file:config name="File_Config"> <file:connection workingDir="/Users/me/myfiles" /> </file:config>
When reading or listing files, you might be interested in the file’s metadata (for example, the file name, full path, size, timestamp, and so on). The connector uses the Mule Message Attributes to access this information. More information about file attributes are available in the reference for this connector.