Samba (SMB2) icon

Samba (SMB2)

Transfer files via Samba (SMB2)

Overview

This node enables interaction with a Samba (SMB2) server to perform file and directory operations over the SMB protocol. It is useful for automating tasks involving shared network drives, such as listing folder contents, uploading or downloading files, creating directories, deleting files or folders, and renaming/moving files or folders.

A common scenario is integrating legacy file shares into automated workflows, for example:

  • Listing files in a shared folder to trigger further processing.
  • Downloading files from a network share for data ingestion.
  • Uploading generated reports or logs to a shared directory.
  • Managing files and folders on a remote SMB server programmatically.

The "List" operation specifically lists the contents of a specified folder path on the SMB server.

Properties

Name Meaning
Folder The path of the folder on the SMB server whose contents you want to list. Example: /public/folder

Output

The output is an array of JSON objects, each representing an item (file or directory) inside the specified folder. Each object contains:

  • type: "d" for directories, "l" for files (links).
  • name: The base name of the item (file or folder name).
  • path: Full path of the item combining the folder path and item name.
  • attributes: File attributes metadata.
  • createTime: Creation timestamp (if available).
  • accessTime: Last access timestamp (if available).
  • modifyTime: Last modification timestamp (if available).
  • changeTime: Last change timestamp (if available).
  • size: Size of the file in bytes.

No binary data is output for the "List" operation; it only returns metadata about folder contents.

Dependencies

  • Requires connection credentials to an SMB2 server (an API key or authentication token configured in n8n).
  • Uses Node.js modules for filesystem streaming and temporary file handling internally.
  • No additional external services are required beyond the SMB server itself.

Troubleshooting

  • Common issues:

    • Incorrect folder path or permissions may cause errors when listing contents.
    • Network connectivity problems to the SMB server.
    • Insufficient permissions to read the directory.
  • Error messages:

    • Errors like "Failed to list directory" usually indicate permission or connectivity issues.
    • If the node throws errors related to SMB connection, verify the SMB server address, credentials, and network accessibility.
    • For permission errors, ensure the user account used has read access to the target folder.
  • Resolution tips:

    • Double-check the folder path syntax and existence on the SMB server.
    • Confirm credentials and network settings.
    • Use the node's "Continue On Fail" option to handle errors gracefully in workflows.

Links and References

Discussion