FTP Nodes for n8n
Introduction
The /n software n8n nodes extend n8n with powerful integration capabilities backed by the /n software node library. These nodes allow workflows to exchange data with external systems using the FTP protocol, either in plaintext or secured with SSL/TLS (FTPS).
Two commonly used nodes for file transfer are the FTP Sender and FTP Trigger nodes:
- The FTP Sender node is used to upload files or data from an n8n workflow to a remote FTP or FTPS server, and may also be used to download files or list directories on demand.
- The FTP Trigger node is used to poll an FTP or FTPS server on a schedule, downloading files, listing directories, or deleting files as part of an automated workflow.
Both nodes support standard FTP authentication as well as SSL/TLS configuration for encrypted sessions. This article provides an overview of both FTP nodes, their basic configuration, and common usage patterns.
Node Installation
Before proceeding, please ensure that the /n software n8n nodes have been installed successfully. For instructions on how to install the /n software n8n nodes, please refer to the installation guide here. Afterwards, assuming the mentioned node location is populated, simply restart your n8n server instance, and the /n software nodes should be searchable via the n8n UI.
Authentication and Connection Overview
Both FTP nodes connect to remote systems using the FTP protocol. At a minimum, you must configure the FTPServer property, which represents the hostname or IP address of the remote FTP server. You may also set the FTPPort if the server is not running on the default port (21 by default).
If the server requires authentication, you must specify the User property and typically the Password. Some servers may also require the Account property.
SSL/TLS (FTPS) Configuration
To enable SSL/TLS:
- Configure SSLStartMode to determine how SSL negotiation is initiated (automatic, explicit, implicit).
- Configure the SSLCert* properties if client certificate authentication is required.
- Configure the SSLAcceptServerCert* properties control how the server certificate is validated.
To accept any server certificate, the SSLAcceptServerCertAcceptAny property may be enabled, though this is not recommended for production environments, and the server's certificate should be set through the SSLAcceptServerCert* properties.
Passive Mode
The Passive property controls whether the node operates in Passive or Active mode. Passive mode (default) is recommended when the client is behind a firewall or NAT device, as the client initiates both control and data connections.
FTP Sender Node
The FTP Sender node is used to send files or data to a remote FTP or FTPS server. Depending on the selected Operation, it can also be used to download files or list directories as part of a workflow.
Send Files
When the Operation property is set to 'Send Files', the node uploads local files or binary data to the FTP server. If uploading local files:
- Set the LocalFile property to a full file path (e.g., C:\test\test.txt) or a file mask (e.g., C:\test\*.txt).
- Set the RemoteFile property to specify the destination file name on the server. By default, this is set to %SourceFileName%, and will take the file name of the local file specified.
- Optionally set the RemotePath property to define the destination directory on the server.
If uploading binary data from a previous node:
- Set the RemoteFile property to define the name of the file to be created on the server.
- LocalFile should be empty in this case.
Additional upload-related properties include:
- Overwrite - Controls whether existing files are overwritten.
- Append - Appends data to an existing remote file instead of overwriting.
- RemoteTempPath or RemoteTemporaryUploadExtension - Allows uploading to a temporary location or extension before renaming into place.
- TransferMode - Specifies ASCII or Binary mode for file transfer.
You may also execute FTP command scripts before or after certain actions using:
- BeforePut
- AfterPut
- AfterConnect
Each script supports standard FTP commands (e.g., cd, mkdir, etc.) and optional error handling directives such as ONERROR FAIL and ONERROR RESUME.
Download Files
When the Operation property is set to 'Download Files', the node downloads multiple remote files. At minimum:
- Configure authentication and connection properties.
- Set the RemotePath and RemoteFile properties to identify which files to download.
The LocalDirectory property may be set to specify where files should be written locally. If left empty, file data is made available as binary output to subsequent nodes. Additional properties include:
- Delete - Deletes the remote file after successful download.
- MaxFileCount - Limits the number of files downloaded per execution.
- MaxFileSize - Limits the maximum file size that can be downloaded (in MB).
- TemporaryDownloadExtension - Appends a temporary extension during download.
You may execute FTP command scripts before or after each download using:
- BeforeGet
- AfterGet
After successfully downloading files, additional information regarding the downloaded files will be returned by the node. For example, this could look like:
[
{
"ReceivedFileName": "test.log",
"ReceivedFileSize": 25913,
"ReceivedFileDate": "6/9/2023 09:42:14 AM",
"ReceivedFileUser": "test",
"ReceivedFilePath": "/home/test"
},
{
"ReceivedFileName": "ab.txt",
"ReceivedFileSize": 32065,
"ReceivedFileDate": "10/25/2023 09:25:59 AM",
"ReceivedFileUser": "test",
"ReceivedFilePath": "/home/test"
}
]
Download Single File
When the Operation is set to 'Download Single File', the node downloads a single file. At minimum:
- Configure authentication and connection properties.
- Set the RemoteFile property to identify which file to download (and if needed, the RemotePath property).
Optionally, set the LocalDirectory to write the file to disk. If not specified, the file will be returned as binary data. Downloaded file information will be returned by the node, for example:
[
{
"ReceivedFileName": "ab.txt",
"ReceivedFileSize": 32065,
"ReceivedFileDate": "10/25/2023 09:25:59 AM",
"ReceivedFileUser": "test",
"ReceivedFilePath": "/home/test"
}
]
List Directory
When the Operation property is set to 'List Directory', the node lists the contents of a remote directory. At minimum:
- Configure authentication and connection properties.
- Set the RemotePath to specify the directory to list.
- Optionally, set the RemoteFile property to a file mask to restrict which files are listed ("*" to list all files).
Directory listing behavior may be influenced by the following properties:
- UseSimpleDirList - Uses the NLST command instead of LIST, returning less (simplified) information about each entry.
- UseMLSD - Uses machine-readable directory listings when supported.
The node returns JSON output containing file and directory information, which can be used by subsequent nodes in the workflow. For example, this could look like:
[
{
"isDirectory": false,
"name": "ab.txt",
"size": 32065,
"time": "10/25/2023 09:25:59 AM"
}
]
FTP Trigger Node
The FTP Trigger node is used to periodically poll an FTP or FTPS server at the interval defined by the n8n trigger schedule (one minute by default). On each poll, the node connects to the FTP server and performs the operation specified by the TriggerOn property.
Receive Files
When TriggerOn is set to receive files:
- Configure the FTPServer, authentication, and SSL/TLS settings as needed.
- Set the RemotePath and FileMask to define which files to download.
The LocalDirectory property may be set to write files to a local directory. If this property is not set, file data is provided as binary data. Other optional properties that may be set include:
- Delete - Removes files after successful download.
- DownloadCacheFile - Creates and/or uses the specified local file, which will information regarding previously downloaded files (managed by the node once set). This may be set to avoid reprocessing previously downloaded files.
Downloaded file data and metadata are provided as JSON after successful execution. For example, this may look like:
[
{
"ReceivedFileName": "test.log",
"ReceivedFileSize": 25913,
"ReceivedFileDate": "6/9/2023 09:42:14 AM",
"ReceivedFileUser": "test",
"ReceivedFilePath": "/home/test"
},
{
"ReceivedFileName": "ab.txt",
"ReceivedFileSize": 32065,
"ReceivedFileDate": "10/25/2023 09:25:59 AM",
"ReceivedFileUser": "test",
"ReceivedFilePath": "/home/test"
}
]
List Directory
When TriggerOn is set to list a directory:
- Configure connection and authentication properties.
- Set the RemotePath if a specific directory should be listed.
The node returns directory entries in JSON format for use in subsequent processing. For example, this may look like:
[
{
"FileName": "2023060820_APP.Log",
"FileSize": 25913,
"FileTime": "Jun 09 2023",
"IsDir": false,
"Listing": "-rw-rw-r-- 1 1000 1000 25913 Jun 09 2023 2023060820_APP.Log"
}
]
Delete Files
When TriggerOn is set to delete files:
- Configure authentication and connection properties.
- Set the RemotePath and FileMask properties to identify which files should be deleted.
After successful execution, JSON data is returned containing the name of each file successfully deleted. For example:
[
{
"DeletedFileName": "test.log"
}
]
We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@nsoftware.com.