FTP Trigger

Trigger a workflow on FTP or SFTP filesystem changes

Overview

The FTP Trigger node monitors changes in a specified folder on an FTP or SFTP server and triggers workflows in n8n when certain file or folder events occur. It is useful for automating processes based on file system activity, such as:

  • Starting a workflow when a new file is uploaded to a specific directory.
  • Reacting to updates or deletions of files/folders.
  • Monitoring for the creation, deletion, or modification of folders.

Practical examples:

  • Automatically process invoices uploaded to an FTP server.
  • Sync files between servers when changes are detected.
  • Alert users when critical configuration files are updated.

Properties

Name Meaning
Protocol File transfer protocol to use. Options: FTP, SFTP.
Trigger On What type of change to monitor. Options: Changes Involving a Specific Folder.
File The specific file to watch. Can be selected from a list or specified by path. Only shown if "Trigger On" is set to a specific file (not used in this default resource/operation).
Watch For The event(s) to trigger on. When "Trigger On" is "specificFolder", options include:
- File Created
- File Deleted
- File Updated
- Folder Created
- Folder Deleted
- Folder Updated
- Watch Folder Updated
Folder The folder to watch for changes. Specify by path. Required when monitoring a specific folder.
Changes within subfolders won't trigger this node Notice: Indicates that only changes in the specified folder (not its subfolders) will trigger the node, except for the "Watch Folder Updated" event.

Output

The node outputs an array of objects, each with a json field containing information about the changed file or folder. The structure includes:

{
  "type": "-",         // "-" for file, "d" for directory
  "name": "filename.txt",
  "size": 12345,
  "modifyTime": "2024-06-01T12:34:56.000Z",
  "accessTime": "2024-06-01T12:34:56.000Z",
  "longname": "",
  "path": "/watched/folder/filename.txt"
}
  • type: "-" for files, "d" for directories.
  • name: Name of the file or folder.
  • size: Size in bytes (0 for deleted items).
  • modifyTime: Last modification time (Date object or ISO string).
  • accessTime: Last access time (Date object or ISO string).
  • longname: (May be empty; not typically used).
  • path: Full path to the file or folder.

Note: The output does not include binary data.

Dependencies

  • External Services: Requires access to an FTP or SFTP server.
  • Credentials:
    • FTP: Host, port, username, password.
    • SFTP: Host, port, username, password, and optionally private key and passphrase.
  • n8n Configuration: Credentials must be configured in n8n for the chosen protocol.

Troubleshooting

Common Issues:

  • Invalid credentials: Ensure correct FTP/SFTP credentials are provided.
  • Network/firewall issues: The n8n instance must be able to reach the FTP/SFTP server.
  • No data found: If no matching files/folders are found during manual execution, you may see:
    • "No data with the current filter could be found"
      Resolution: Adjust your filter settings or ensure there are recent changes in the watched folder.

Error Messages:

  • Connection errors: Indicate problems connecting to the FTP/SFTP server. Check host, port, and network connectivity.
  • Authentication failures: Double-check username/password or private key details.

Links and References

Discussion