Samba (SMB2) icon

Samba (SMB2)

Transfer files via Samba (SMB2)

Overview

This node enables interaction with a Samba (SMB2) server to perform file operations such as listing folder contents, downloading files, uploading files, deleting files or folders, and renaming/moving files or folders. It is useful in scenarios where you need to automate file management tasks on SMB shares, for example:

  • Listing files in a shared network folder to process or monitor them.
  • Downloading files from an SMB share to use their content in workflows.
  • Uploading generated or transformed files back to the SMB share.
  • Deleting obsolete files or folders automatically.
  • Renaming or moving files/folders within the SMB share.

The "List" operation specifically lists the contents of a specified folder path on the SMB server, returning metadata about each item.

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 the following fields:

  • type: "d" for directories, "l" for files (links).
  • name: The base name of the file or directory.
  • path: The full path combining the folder path and the item's filename.
  • attributes: File attributes as provided by the SMB server.
  • createTime: Creation time as a JavaScript Date object (if available).
  • accessTime: Last access time as a Date object (if available).
  • modifyTime: Last modification time as a Date object (if available).
  • changeTime: Change time as a Date object (if available).
  • size: Size of the file in bytes.

No binary data is output for the "List" operation.

Dependencies

  • Requires connection credentials to an SMB2 server (an API key or authentication token configured in n8n).
  • Uses the SMB2 protocol client internally to communicate with the server.
  • Temporary file handling and streaming utilities are used for other operations but not relevant for "List".

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 folder.
  • Error messages:

    • Errors related to connection failure or permission denied will be thrown if the node cannot access the folder.
    • If the folder does not exist, an error indicating failure to read the directory will occur.
  • Resolution tips:

    • Verify the folder path is correct and accessible.
    • Check SMB server credentials and permissions.
    • Ensure network connectivity to the SMB server.

Links and References

Discussion