n8n FTP Node - Tutorial, Examples, Best Practices
📁
Action Node

n8n FTP Node

Master the n8n FTP node to transfer files to and from FTP/SFTP servers. Learn authentication, file operations, binary data handling, troubleshooting, and real-world automation patterns.

File transfer remains the backbone of business data exchange. Despite APIs and cloud services, countless organizations still rely on FTP and SFTP servers for vendor data feeds, backup systems, and batch file processing.

The n8n FTP node bridges this gap. Automate file transfers without writing scripts or managing cron jobs.

Need to pull daily reports from a supplier? Upload processed files to a client server? Sync data between systems? The FTP node handles it within your visual workflows, supporting both FTP and SFTP protocols.

The File Transfer Automation Challenge

Automating FTP operations sounds simple until you hit the edge cases:

  • Binary files need special handling
  • Paths behave differently across servers
  • Timeouts occur without clear error messages
  • No native FTP trigger means creative solutions for detecting new files

This guide addresses all of these challenges with practical solutions drawn from real n8n community discussions.

What You’ll Learn

  • How to choose between FTP and SFTP credentials for your use case
  • Configuring all five FTP operations: List, Download, Upload, Delete, and Rename
  • Working with binary data and connecting to file processing workflows
  • Building automation patterns without a native FTP trigger
  • Troubleshooting timeout, permission, and connection errors
  • Security best practices for production file transfers
  • Real-world examples you can adapt immediately

When to Use the FTP Node

Before reaching for the FTP node, confirm it fits your use case. Some scenarios have better alternatives within n8n.

ScenarioBest SolutionWhy
Download file from web URLHTTP Request nodePurpose-built for HTTP downloads
Upload to Google Drive or S3Dedicated cloud storage nodesNative authentication and features
Read local files on n8n hostRead/Write Files from Disk nodeDirect filesystem access
Transfer to remote FTP serverFTP nodeDesigned for FTP/SFTP protocols
Sync with legacy vendor systemFTP nodeLegacy systems often only support FTP
Automated backup to FTP serverFTP nodeReliable for scheduled file uploads
Process files from supplierFTP node + processing nodesComplete workflow automation

Rule of thumb: Use the FTP node when the remote system specifically requires FTP or SFTP protocol. For HTTP-based file downloads, cloud storage, or local files, other nodes provide simpler solutions.

FTP Node vs HTTP Request for Files

New users sometimes confuse these nodes for file operations:

  • FTP node: Connects to FTP/SFTP servers using the file transfer protocol
  • HTTP Request node: Downloads files via HTTP/HTTPS URLs

If your file is accessible via a web URL (starting with http:// or https://), use HTTP Request. If you need to connect to a server with FTP credentials and navigate directories, use the FTP node.

Understanding FTP and SFTP Protocols

Before configuring credentials, understand the key differences between these protocols.

FTP (File Transfer Protocol)

FTP is the original file transfer protocol dating back to 1971. It transfers files over TCP, typically on port 21.

Characteristics:

  • Sends credentials and data in plain text
  • Widely supported by legacy systems
  • Simple to configure
  • No built-in encryption

Security concern: FTP credentials travel unencrypted over the network. Anyone monitoring network traffic can capture usernames and passwords. Only use FTP on trusted networks or when no alternative exists.

SFTP (SSH File Transfer Protocol)

SFTP runs over SSH, typically on port 22. Despite the similar name, it is completely different from FTP.

Characteristics:

  • All data and credentials are encrypted
  • Supports key-based authentication
  • Single connection (no separate data channel)
  • Modern security standards

Recommendation: Always prefer SFTP when the server supports it. The encryption protects credentials and file contents during transfer.

FTPS (Not Supported)

n8n currently does not support FTPS (FTP over TLS/SSL). If your server requires FTPS specifically, you may need to use the Execute Command node with a command-line FTP client, or request this feature from n8n.

Passive vs Active FTP Mode

FTP uses two channels: a control channel for commands and a data channel for file transfers. How the data channel is established determines whether FTP operates in active or passive mode.

Active mode: The server initiates the data connection back to the client. This often fails when the client is behind a firewall or NAT because incoming connections are blocked.

Passive mode: The client initiates both connections. This works better with firewalls because all connections are outbound from the client’s perspective.

The n8n FTP node uses passive mode by default, which is the correct choice for most environments. If you experience connection issues where authentication succeeds but file operations hang or timeout, the server may not support passive mode properly. In such cases:

  1. Verify the FTP server’s passive port range is accessible
  2. Check if a firewall is blocking the passive data ports (typically 1024-65535)
  3. Contact the server administrator to confirm passive mode configuration

SFTP avoids this complexity entirely by using a single encrypted connection for both commands and data. This is another reason to prefer SFTP when available.

Protocol Comparison

AspectFTPSFTP
Default port2122
EncryptionNoneFull (SSH)
AuthenticationUsername/passwordUsername/password or SSH keys
Firewall complexityHigh (multiple ports)Low (single port)
Connection modeActive or PassiveSingle channel
n8n supportYesYes
RecommendedLegacy onlyYes

Setting Up FTP Credentials

The FTP node requires credentials to authenticate with the remote server. n8n provides separate credential types for FTP and SFTP.

FTP Credentials

Use this credential type for standard FTP connections without SSH.

  1. Go to Credentials in n8n
  2. Click Add Credential
  3. Search for and select FTP
  4. Configure the following:
FieldDescriptionExample
HostServer hostname or IPftp.example.com
PortFTP port (default 21)21
UsernameFTP account usernameftpuser
PasswordFTP account passwordsecretpassword

SFTP Credentials

Use this credential type for secure SSH-based file transfers.

  1. Go to Credentials in n8n
  2. Click Add Credential
  3. Search for and select SFTP
  4. Configure authentication method:

Password Authentication:

FieldDescriptionExample
HostServer hostname or IPsftp.example.com
PortSSH port (default 22)22
UsernameSSH account usernamesftpuser
PasswordSSH account passwordsecretpassword

Private Key Authentication:

For enhanced security, use SSH key pairs instead of passwords.

FieldDescription
HostServer hostname or IP
PortSSH port (default 22)
UsernameSSH account username
Private KeyYour private key in OpenSSH format
PassphraseKey passphrase (if encrypted)

The private key must be in OpenSSH format. Keys generated with ssh-keygen -o work correctly. If you have a PuTTY .ppk file, convert it first using PuTTYgen.

Example private key format:

-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtz
c2gtZWQyNTUxOQAAACBIvRqgM4...
-----END OPENSSH PRIVATE KEY-----

Testing Credentials

After configuring credentials, test them before using in workflows:

  1. Create a new workflow
  2. Add the FTP node
  3. Select your credentials
  4. Set Operation to List
  5. Enter a known path (like / or /home)
  6. Click Test step

If the connection fails, check the error message for clues about hostname resolution, authentication, or network connectivity.

For credential management best practices, see our n8n credential management guide.

Your First FTP Operation

Let’s walk through basic FTP operations step by step.

Step 1: Add the FTP Node

  1. Open your n8n workflow
  2. Click + to add a node
  3. Search for FTP
  4. Click to add it

Step 2: Configure a List Operation

The List operation shows files and folders on the remote server. It is useful for discovering what files are available before downloading.

  1. Select your FTP or SFTP credentials
  2. Set Protocol to match your credential type
  3. Set Operation to List
  4. Enter the Path to list (e.g., /uploads or /home/user/reports)
  5. Click Test step

Step 3: Read the Response

The List operation returns an array of file and folder information:

[
  {
    "type": "file",
    "name": "report_2024.csv",
    "size": 15234,
    "modifyTime": 1703500800000,
    "accessTime": 1703504400000
  },
  {
    "type": "directory",
    "name": "archive",
    "size": 4096,
    "modifyTime": 1703414400000,
    "accessTime": 1703500800000
  }
]

You can now filter or loop through these results to process specific files.

Step 4: Download a File

To download a file you discovered:

  1. Add another FTP node
  2. Set Operation to Download
  3. Enter the full Path including filename (e.g., /uploads/report_2024.csv)
  4. Click Test step

The file downloads as binary data attached to the output item. You can view it in the Binary tab of the node output.

All FTP Operations Explained

The FTP node supports five operations. Each has specific configuration options and use cases.

List: View Directory Contents

Lists files and folders at a specified path.

Parameters:

ParameterDescriptionRequired
PathRemote directory pathYes
RecursiveInclude subdirectoriesNo

Recursive option: When enabled, the node traverses subdirectories and returns all files in the tree. Use with caution on directories with many files.

Output structure:

// Each item contains:
{
  type: "file" | "directory",
  name: "filename.ext",
  size: 12345,          // bytes
  modifyTime: 1703500800000,  // timestamp
  accessTime: 1703504400000   // timestamp
}

Common pattern: List files, then use a Loop node to process each file individually.

Download: Retrieve Files

Downloads a file from the remote server to n8n as binary data.

Parameters:

ParameterDescriptionRequired
PathFull path including filenameYes

Output: The file becomes available as binary data attached to the output item. The binary property name defaults to data.

Accessing downloaded files:

After downloading, the binary data is available for:

  • Passing to other nodes (email attachments, cloud storage upload)
  • Writing to local disk with Read/Write Files from Disk node
  • Processing with Extract from File node

For detailed binary data handling, see our n8n binary data guide.

Upload: Send Files to Server

Uploads a file to the remote server.

Parameters:

ParameterDescriptionRequired
PathDestination path including filenameYes
Binary FileUpload binary data (on) or text content (off)Yes
Input Binary FieldName of binary property to uploadWhen binary

Binary upload example:

When uploading a file from a previous node:

  1. Enable Binary File
  2. Set Input Binary Field to the property name (usually data)
  3. Set Path to the destination like /uploads/myfile.csv

Text content upload:

When uploading text directly:

  1. Disable Binary File
  2. Enter the text content or use an expression
  3. The file is created with that text content

Creating the binary data:

Before uploading, you need binary data from somewhere:

Delete: Remove Files and Folders

Deletes files or folders from the remote server.

Parameters:

ParameterDescriptionRequired
PathPath to deleteYes
FolderEnable to delete foldersNo
RecursiveDelete folder contents recursivelyWhen folder enabled

Safety warning: Delete operations are irreversible. Always test on non-production servers first, and consider implementing a confirmation step or archiving before deletion.

Folder deletion:

To delete a folder, you must enable both Folder and Recursive options. The node refuses to delete non-empty folders without recursive mode.

Rename: Move and Rename Files

Renames or moves files and folders.

Parameters:

ParameterDescriptionRequired
Old PathCurrent file locationYes
New PathDestination pathYes
Create DirectoriesCreate missing parent directoriesNo

Moving files:

The Rename operation doubles as a move operation. To move a file to a different directory, specify the full destination path:

Old Path: /incoming/report.csv
New Path: /processed/2024/01/report.csv

Create Directories option:

When enabled, the node creates any missing directories in the destination path. This is useful for organizing files into date-based folder structures.

Creating Folders (Workaround)

The FTP node lacks a dedicated “Create Folder” operation, but you can create directories using two workarounds.

Method 1: Create via Rename with Create Directories

If you have any file to move or rename, enable “Create Directories” and specify the new folder path:

  1. Add FTP node with Rename operation
  2. Set Old Path to an existing file
  3. Set New Path to /new/folder/path/filename.txt
  4. Enable Create Directories

The entire folder structure is created automatically.

Method 2: Upload and Delete Placeholder

To create an empty folder structure without moving existing files:

  1. FTP (Upload) - Upload a small placeholder file:

    • Path: /new/folder/structure/.placeholder
    • Binary File: Off
    • Content: temp
  2. FTP (Delete) - Remove the placeholder:

    • Path: /new/folder/structure/.placeholder

This leaves the folder structure in place. Here is the workflow pattern:

// First node: Upload placeholder
{
  "operation": "upload",
  "path": "/clients/{{ $json.clientId }}/documents/.placeholder",
  "binaryFile": false,
  "content": "temp"
}

// Second node: Delete placeholder
{
  "operation": "delete",
  "path": "/clients/{{ $json.clientId }}/documents/.placeholder"
}

Use this pattern when you need to prepare folder structures before files arrive.

Working with Binary Data

Understanding binary data flow is essential for FTP automations. Files in n8n travel as binary data attached to items.

How Binary Data Works

When you download a file via FTP, n8n stores it as a binary attachment rather than in the JSON data. Access it through the Binary tab in node outputs.

Binary property structure:

{
  "json": {
    // Regular data
  },
  "binary": {
    "data": {
      "fileName": "report.csv",
      "fileExtension": "csv",
      "mimeType": "text/csv",
      "data": "base64encodedcontent..."
    }
  }
}

The default property name is data, but nodes can use different names. Always check the binary output to confirm the property name.

Connecting to File Processing

A typical pattern downloads files, processes them, and re-uploads:

  1. FTP (Download) - Retrieves the file
  2. Extract from File - Parses CSV/Excel content
  3. Processing nodes - Transform the data
  4. Convert to File - Creates output file
  5. FTP (Upload) - Sends processed file back

Download Then Upload Pattern

To download from one server and upload to another:

  1. First FTP node downloads file (binary data in data property)
  2. Second FTP node uploads with Input Binary Field set to data

The binary data flows directly between nodes without needing intermediate storage.

Dynamic Paths and Filenames

Static paths work for simple cases, but real automations often need dynamic paths based on dates, IDs, or data from previous nodes.

Using Expressions for Paths

The Path field accepts n8n expressions. Reference data from previous nodes:

// Use filename from previous node
/uploads/{{ $json.fileName }}

// Use ID from webhook data
/customers/{{ $('Webhook').item.json.customerId }}/reports/

// Combine multiple fields
/data/{{ $json.region }}/{{ $json.productType }}/export.csv

Date-Based Folder Structures

Organize files by date using n8n’s date functions:

// Year/Month/Day structure
/archives/{{ $now.format('yyyy') }}/{{ $now.format('MM') }}/{{ $now.format('dd') }}/

// ISO date in filename
/reports/daily_report_{{ $now.format('yyyy-MM-dd') }}.csv

// Month name folder
/monthly/{{ $now.format('MMMM') }}/report.xlsx

Handling Special Characters

File paths with spaces or special characters need careful handling:

// Spaces in paths generally work
/My Documents/Reports/file.csv

// Avoid these characters in paths
< > : " | ? * \

If incoming data might contain problematic characters, sanitize it first in a Code node:

const safeName = $json.fileName.replace(/[<>:"|?*\\]/g, '_');
return [{ json: { safeName } }];

Automation Patterns

The FTP node lacks a native trigger, meaning it cannot automatically start workflows when files appear. Here are patterns to work around this limitation.

Pattern 1: Poll for New Files

Use a Schedule Trigger to periodically check for new files:

  1. Schedule Trigger - Runs every 5 minutes (or your preferred interval)
  2. FTP (List) - Gets current files in the target directory
  3. Code node - Compare against previously seen files (stored in database or static data)
  4. IF node - Branch if new files exist
  5. FTP (Download) - Download new files
  6. Processing nodes - Handle the files
  7. FTP (Rename) - Move processed files to archive folder

Key considerations:

  • Store processed filenames to avoid reprocessing
  • Move processed files to prevent duplicate handling
  • Set reasonable poll intervals to avoid server overload

Pattern 2: Download, Process, Re-upload

A common integration pattern:

  1. Schedule Trigger - Daily at 6 AM
  2. FTP (Download) - Get supplier data file
  3. Extract from File - Parse CSV content
  4. Transform nodes - Clean and enrich data
  5. Convert to File - Create output format
  6. FTP (Upload) - Send to destination server
  7. FTP (Rename) - Archive source file

Pattern 3: FTP to Cloud Storage Sync

Migrate files from legacy FTP to modern cloud storage:

  1. Schedule Trigger - Every hour
  2. FTP (List) - Check for new files
  3. Filter node - Only unprocessed files
  4. FTP (Download) - Retrieve files
  5. Google Drive / S3 node - Upload to cloud
  6. FTP (Delete or Rename) - Clean up source

Pattern 4: Webhook-Triggered File Processing

When an external event signals file readiness:

  1. Webhook node - Receives notification that file is ready
  2. FTP (Download) - Retrieve the specified file
  3. Processing nodes - Transform data
  4. HTTP Request - Send results to API
  5. FTP (Delete) - Remove processed file

This pattern avoids polling by using webhooks to trigger on-demand.

Error Handling and Troubleshooting

FTP operations can fail for many reasons. Here is how to diagnose and handle common issues.

Common Error Reference

ErrorLikely CauseSolution
Connection refusedWrong host/port, firewallVerify server address and port, check firewall rules
Authentication failedWrong credentialsDouble-check username and password
Permission deniedInsufficient file permissionsContact server admin for access
No such filePath does not existVerify path, check for typos, use List first
Connection timeoutNetwork issues, server overloadIncrease timeout, try during off-peak hours
ENOTFOUNDDNS resolution failedCheck hostname spelling, try IP address
Directory not emptyTrying to delete non-empty folderEnable recursive delete option
Auth succeeds but hangsPassive mode port blockedCheck firewall allows passive ports (1024-65535)
ECONNRESET during transferConnection dropped mid-transferIncrease timeout, check network stability

Timeout Issues

FTP operations can timeout on:

  • Large file transfers
  • Slow network connections
  • Overloaded servers

Solutions:

  1. Increase node timeout: In node settings, increase the timeout value
  2. Check network: Test connection speed to the FTP server
  3. Off-peak scheduling: Run large transfers during low-traffic periods
  4. Chunk large files: Split very large files into smaller pieces

For comprehensive timeout troubleshooting, see our fixing n8n timeout errors guide.

Retry Configuration

Enable automatic retries for transient failures:

  1. Open the FTP node settings
  2. Enable Retry On Fail
  3. Set Max Tries (e.g., 3)
  4. Set Wait Between Tries in milliseconds (e.g., 5000)

This handles temporary network glitches and brief server unavailability automatically.

Error Trigger Workflow

For critical FTP automations, set up error monitoring:

  1. Create a separate workflow with an Error Trigger node
  2. Configure it to run when your FTP workflow fails
  3. Send notifications via email, Slack, or SMS

This ensures you learn about failures quickly rather than discovering missing data later.

For debugging complex workflows, try our free workflow debugger tool.

Real-World Examples

These examples demonstrate practical FTP automation patterns you can adapt.

Example 1: Daily Report Download and Email

Scenario: Download a daily sales report from a supplier FTP and email it to the team.

Workflow:

  1. Schedule Trigger - 7:00 AM daily
  2. FTP (Download) - Path: /reports/sales_{{ $now.minus(1, 'day').format('yyyyMMdd') }}.csv
  3. Send Email node - Attach the binary data, send to distribution list

FTP Configuration:

Protocol: SFTP
Operation: Download
Path: /reports/sales_{{ $now.minus(1, 'day').format('yyyyMMdd') }}.csv

The expression grabs yesterday’s report, accounting for the typical delay in report generation.

Example 2: Website Backup to FTP

Scenario: Backup website files to a remote FTP server weekly.

Workflow:

  1. Schedule Trigger - Sunday 2:00 AM
  2. Execute Command - Create compressed archive: tar -czf /tmp/backup.tar.gz /var/www/html
  3. Read Binary File - Load the archive
  4. FTP (Upload) - Path: /backups/website_{{ $now.format('yyyy-MM-dd') }}.tar.gz
  5. FTP (List) - List backup directory
  6. Code node - Find backups older than 30 days
  7. FTP (Delete) - Remove old backups

This creates rolling backups with automatic cleanup.

Example 3: Order File Processing from Supplier

Scenario: Process order files that arrive on a supplier FTP server.

Workflow:

  1. Schedule Trigger - Every 15 minutes
  2. FTP (List) - Path: /incoming
  3. Filter - Only .csv files not starting with processed_
  4. Loop Over Items - Process each file
  5. FTP (Download) - Get the file
  6. Extract from File - Parse CSV
  7. HTTP Request - POST orders to your API
  8. FTP (Rename) - Move to /incoming/processed_{{ $json.name }}

The rename step prevents reprocessing by prefixing completed files.

Example 4: Multi-File Upload from Form

Scenario: Accept file uploads via web form and transfer to client FTP.

Workflow:

  1. Webhook - Receives form submission with files
  2. Split Out - Handle each uploaded file separately
  3. FTP (Upload) - Path: /uploads/{{ $json.clientId }}/{{ $json.fileName }}

Webhook configuration:

HTTP Method: POST
Response Mode: When Last Node Finishes
Binary Property: files

This handles variable numbers of uploaded files, organizing them by client ID.

Security Best Practices

File transfers often contain sensitive data. Follow these practices to protect your automations.

Always Prefer SFTP

FTP transmits credentials and data without encryption. Anyone on the network path can intercept:

  • Your username and password
  • File contents
  • Directory listings

SFTP encrypts everything. Unless the remote server only supports FTP, always use SFTP credentials.

Use SSH Keys Over Passwords

SSH key authentication is more secure than passwords:

  • Keys cannot be guessed or brute-forced easily
  • Keys can be rotated without updating n8n
  • Compromised keys can be revoked individually

Generate a dedicated key pair for n8n rather than reusing personal keys.

Principle of Least Privilege

Request minimal FTP permissions:

  • Read-only access if you only download
  • Write access limited to specific directories
  • No delete permissions unless absolutely required

This limits damage if credentials are compromised.

Secure Credential Storage

n8n encrypts credentials at rest, but additional precautions help:

  • Use unique credentials per workflow purpose
  • Rotate credentials periodically
  • Remove unused credentials
  • Limit who can access credential management

For more security guidance, see our n8n self-hosting security guide.

Firewall and IP Whitelisting

If your FTP server supports it, whitelist the IP address of your n8n instance. This prevents unauthorized connection attempts even if credentials leak.

For self-hosted n8n, use a static IP or document your server’s address for firewall rules.

Pro Tips and Best Practices

1. Check Before Downloading

Before downloading, verify the file exists to avoid errors:

  1. Use List operation with the parent directory
  2. Filter results for your target filename
  3. Only proceed if found

This prevents cryptic errors when expected files are missing.

2. Use Temporary Filenames During Upload

Uploading directly to the final filename risks partial file visibility:

# Bad: Other systems might see incomplete file
/data/report.csv

# Better: Upload to temp, then rename
/data/.tmp_report.csv → /data/report.csv

Use two FTP operations: Upload to a hidden/temp name, then Rename to the final name.

3. Implement Logging

Add Set nodes after critical operations to log activity:

{
  "timestamp": "{{ $now }}",
  "operation": "download",
  "file": "{{ $json.path }}",
  "status": "success"
}

Send logs to a database or logging service for troubleshooting and audit trails.

4. Handle Empty Directories

List operations on empty directories return empty arrays. Check for this:

// In an IF node condition
{{ $json.length > 0 }}

Route empty results to a different path to avoid errors in downstream processing.

5. Archive Instead of Delete

Rather than deleting processed files, move them to an archive folder:

/incoming/file.csv → /archive/2024/01/file.csv

This preserves files for debugging and audit purposes while keeping the incoming folder clean.

6. Monitor Transfer Health

Set up regular health checks:

  • Track successful/failed transfer counts
  • Alert on consecutive failures
  • Monitor file sizes for anomalies
  • Log transfer durations to detect slowdowns

For help implementing robust file transfer workflows, explore our workflow development services or consulting packages.

Frequently Asked Questions

How do I check for new files on an FTP server without a trigger?

n8n lacks a native FTP trigger, so you must implement polling:

  1. Use a Schedule Trigger at regular intervals (every 5 minutes, hourly)
  2. List the target directory
  3. Compare results against previously processed files
  4. Download and process only new files

Track processed files by:

  • Storing filenames in a database or n8n static data
  • Moving completed files to an archive folder
  • Renaming with a prefix like processed_

The key is having a reliable way to identify new files versus already-handled ones.

Why is my FTP upload timing out?

Common causes:

  • Large file sizes exceeding timeout limits
  • Slow network connections
  • Server-side upload restrictions
  • Passive mode port blocking (see Protocol section above)

Troubleshooting steps:

  1. Test with a small file first to isolate size-related issues
  2. Increase the node timeout in settings
  3. Check server upload size limits
  4. Compress files before upload
  5. Schedule transfers during off-peak hours

If uploads work manually via FileZilla but fail in n8n, check for network restrictions or proxy configurations on your n8n instance.

How do I use data from previous nodes to set the filename?

Use n8n expressions in the Path field:

// From current item
/uploads/{{ $json.customerId }}_{{ $json.reportName }}.csv

// From specific node
/reports/{{ $('Webhook').item.json.orderId }}.pdf

// Date-based naming
/daily/report_{{ $now.format('yyyy-MM-dd') }}.csv

Important: Sanitize values that might contain invalid path characters. Use a Code node if needed:

const safeName = $json.fileName.replace(/[<>:"|?*\\]/g, '_');

Can I create folders on the FTP server?

The FTP node lacks a dedicated “Create Folder” operation. Use these workarounds:

Method 1: Rename with Create Directories

  • Use the Rename operation
  • Enable “Create Directories” option
  • The destination path folders are created automatically

Method 2: Placeholder file technique

  1. Upload a tiny placeholder file to /new/folder/.placeholder
  2. Delete the placeholder immediately
  3. The folder structure remains

See the “Creating Folders (Workaround)” section for detailed code examples.

What is the difference between FTP and SFTP in n8n?

Despite similar names, these are completely different protocols:

AspectFTPSFTP
EncryptionNone (plain text)Full (SSH tunnel)
Default port2122
Auth methodsPassword onlyPassword or SSH keys
SecurityInsecureSecure

In n8n:

  • Select the Protocol matching your credential type
  • SFTP credentials support private key authentication
  • Always prefer SFTP when available

Note: FTPS (FTP over TLS) is a third protocol that n8n does not currently support.

Ready to Automate Your Business?

Tell us what you need automated. We'll build it, test it, and deploy it fast.

✓ 48-72 Hour Turnaround
✓ Production Ready
✓ Free Consultation
⚡

Create Your Free Account

Sign up once, use all tools free forever. We require accounts to prevent abuse and keep our tools running for everyone.

or

You're in!

Check your email for next steps.

By signing up, you agree to our Terms of Service and Privacy Policy. No spam, unsubscribe anytime.

🚀

Get Expert Help

Add your email and one of our n8n experts will reach out to help with your automation needs.

or

We'll be in touch!

One of our experts will reach out soon.

By submitting, you agree to our Terms of Service and Privacy Policy. No spam, unsubscribe anytime.