Package Information
Documentation
DOKU SFTP for n8n
DOKU SFTP is a community node for listing, downloading, uploading, deleting, and moving files over SFTP or FTP. It reuses the built-in SFTP and FTP credentials, including the SFTP private-key and passphrase fields. n8n FTP node and credentials
Install
On self-hosted n8n, go to Settings → Community Nodes → Install and enter n8n-nodes-doku-sftp-custom@1.0.0-snapshot-4 for the snapshot. Use n8n-nodes-doku-sftp-custom once the stable release is published. Search for DOKU SFTP or DOKU SFTP Trigger in the node picker, choose the protocol, and select an existing credential for it. The workflow node type is n8n-nodes-doku-sftp-custom.sftpCustom. n8n community node installation
Match filenames
Choose a mode under Match By. Enter the remote directory in Path or Folder Path when using a filename pattern.
| Match By | Input | Behavior |
|---|---|---|
| All Entries | /inbox |
List the folder. Turn on Recursive to include its descendants. |
| Exact Path | /inbox/file_20261110.txt |
Use a full path for Download, Delete, or Rename. |
| Exact Filename | file_${today}.txt |
Match one basename. ${today} expands to YYYYMMDD in the workflow timezone. |
| Wildcard | file*.txt |
Match the whole basename. * matches zero or more characters and ? matches one. |
| Regular Expression | ^file_\d{8}\.txt$ |
Search the basename with RE2 syntax. Use anchors to match the full name. Enter the pattern without slash delimiters. |
For a non-recursive exact filename, SFTP looks up the path directly and FTP uses MLST when the server supports it. A wildcard with no * or ? also uses exact lookup. Wildcards and regex use directory listings and filter entries on the client. Recursive applies to List. Regex supports capture groups and inline flags such as (?i). RE2 syntax
Operations
- List returns an item with metadata and the remote path for each matching entry.
- Download keeps the input item’s JSON and writes each matched file to its own output item using Put Output File in Field. SFTP supports Enable Concurrent Reads, Max Concurrent Reads, and Chunk Size.
- Upload accepts a complete destination path and either an Input Binary Field or UTF-8 File Content. It creates missing parent directories.
- Delete supports Folder and Recursive in Exact Path mode. For filename patterns, enable Allow Multiple Matches to delete more than one file.
- Rename supports Create Directories. For filename patterns, set New Path to
/archive/${filename}to keep each original basename. With a regex like^file_(\d{8})\.txt$, use/archive/report_$1.txtto reuse the date capture. Place the placeholders in the destination basename. Patterned renames reject duplicate or existing destinations before moving files.
Filename patterns select regular files for Download, Delete, and Rename. Use Exact Path to address a folder or symbolic link directly where the operation supports it. A filename pattern with no matches emits zero items. Batch transfers and changes run file by file. If a server fails midway through a batch, earlier successful changes remain on the server.
Prevent overwrites during SFTP uploads
Replace Existing File is on by default. Turn it off to fail if the exact destination already exists. Under Additional Conflict Criteria, add one or more exact names, wildcard patterns, or regex patterns. If any criterion matches an entry in the destination folder, the upload fails.
For destination /reports/20261110.xlsx, use Exact Filename criteria ${stem}.xls and ${stem}.xls_b to reject both alternatives. ${filename} is the full destination basename, ${stem} excludes the last extension, and ${ext} includes its leading dot. ${today} uses the workflow timezone.
To handle conflicts in the workflow, set Settings → On Error → Continue (using error output). The error object at $json.error includes message, code: SFTP_UPLOAD_CONFLICT, path, and existingPaths. With replacement off, the node uploads to a temporary name and then renames it to the destination. SFTP servers must support standard rename, including its rejection of an existing destination.
Trigger a workflow from remote files
Use DOKU SFTP Trigger as the first node, set Poll Times, choose the FTP or SFTP credential, and enter the remote folder. Watch For supports created, updated, and deleted events for files and folders. These events watch immediate entries. Watched Folder Updated observes changes to the folder's own metadata. Use Match By to filter entry names with an exact name, wildcard, or regex.
Choose File Present (Every Poll) to emit one item for each matching file still in the folder on every poll, including the first poll. Files can be processed again on the next poll if a downstream node fails. To keep an existing destination file, turn off Replace Existing File on SFTP Upload and handle SFTP_UPLOAD_CONFLICT in the error output. Moving a source file out of the watched folder also stops it from being emitted.
For change events, the first automatic poll records the current entries. Enable Emit Existing Entries on First Poll for a creation event to process the existing entries as well. Each trigger item contains its metadata, the remote path, and the event field. A delete event uses the entry's last observed metadata. A manual test previews current matches with preview: true and leaves the automatic snapshot untouched. An empty preview reports that no entries match.
The trigger compares observed snapshots. Files created and removed between polls may go unseen. To migrate an existing SFTP Trigger, select the new node, reconnect it, and copy the poll schedule, folder, event, and credential. The new type is n8n-nodes-doku-sftp-custom.sftpTrigger. Original SFTP Trigger package
SFTP connection recovery
SFTP Max Attempts defaults to five total attempts. The node reconnects with exponential backoff for temporary network errors such as a disconnect before the handshake. It retries listing and transfers after a disconnect. A retried upload opens the input again and starts writing the same destination from the beginning. Authentication and remote permission errors fail immediately.
When a disconnect makes the result of a delete or rename uncertain, the node reconnects to verify the remote paths. It reports success if it can confirm the requested result, or returns an error with the paths to check. The trigger retries its poll through the same connection handling and keeps its last snapshot if the poll fails.
Development
Use Node.js 20.19 or later.
npm ci
npm test
npm pack
Use lowercase prerelease versions such as 1.0.0-snapshot-1 with npm publish --tag snapshot. n8n 1.123.62 rejects uppercase letters in the installer’s package field, including the version suffix. Use npm publish --tag latest for stable versions.