Samba (SMB2) icon

Samba (SMB2)

Transfer files via Samba (SMB2)

Overview

This node allows interaction with a Samba (SMB2) file server to perform common 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 them further.
  • Downloading files from an SMB share into your workflow for analysis or backup.
  • Uploading generated reports or data files back to the SMB share.
  • Cleaning up old files or reorganizing files by renaming or moving them.

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. For example: /public/folder

Output

The output is an array of JSON objects, each representing an item (file or directory) inside the specified folder. Each item includes 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 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.

Dependencies

  • Requires connection credentials to an SMB2 server (an API key or authentication token configured in n8n).
  • Uses internal helper functions to establish the SMB connection and read directory contents.
  • No external APIs beyond the SMB server are required.

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

    • Errors related to connection failures or permission denials will be thrown.
    • If the node fails, check that the SMB server address, credentials, and folder path are correct.
    • Ensure the user account used has read access to the target folder.

Links and References

Discussion