The FTP connector operations can handle file transfers over FTP and SFTP protocols.
FTP and SFTP Operations
- Copy - Copies the file from a source path to a target path.
- Create Directory - Creates a new directory at a given directory path.
- Delete - Deletes a file at a given path, provided that it is not locked.
- List - Lists all files in a given directory path that match a specified matcher, such as file name patterns, dates, locations, and sizes.
- Move - Moves a file from a given source path to a target path.
- Read - Reads the file in a given path, sets its content in the payload, and sets its attributes.
- Rename - Provides a new file name for the a file at a given path.
- Write - Writes content to a file. It can also map data and perform transformations similar to the Transform component.
Note: This connector module only works with Mule 4 and Studio 7.
Lists files on an FTP server.
- Provide a source to your flow, such as a Scheduler trigger with a Fixed Frequency of every 30 seconds (where Frequency = 30 and Time Unit = Seconds).
- Set up a List operation for the FTP connector:
- Set up or select a configuration for the FTP connector.
- Provide the Path (or Directory Path) to the filesExample:
- After the List operation, add a For Each to your flow. You can retain the default configuration.
- Within the For Each component, add a Logger. In Design Center, use the f(x) button to provide this Message:
attributes.fileName. In Anypoint Studio, add the following Message to your Logger:
- Deploy or Run your application.
- After your application deploys (or is running), check the Logs or Console. You can find the file names in the log, for example: INFO 12:40:49 my_file.txt