Samba (SMB2) icon

Samba (SMB2)

Transfer files via Samba (SMB2)

Overview

This node enables file and folder operations on a Samba (SMB2) server, specifically supporting renaming or moving files and folders within the SMB share. The "Rename" operation changes the path of an existing file or folder from an old location to a new one.

Common scenarios where this node is useful include:

  • Organizing files by renaming or moving them to different directories on a network share.
  • Automating file management workflows that require renaming files after processing.
  • Integrating with other systems to update file paths dynamically on SMB shares.

For example, you could rename /public/documents/old-file.txt to /public/documents/new-file.txt as part of a workflow that processes and archives documents.

Properties

Name Meaning
Old Path The current full path of the file or folder to rename/move. Example: /public/documents/old-file.txt
New Path The new full path for the file or folder after renaming/moving. Example: /public/documents/new-file.txt
Options Additional options for the rename operation:
- Create Directories Boolean flag indicating whether to recursively create destination directories if they do not exist when renaming.

Output

The output consists of JSON objects representing each input item processed. For the rename operation, the output simply returns the original input data unchanged upon success.

If an error occurs during renaming, and the node is configured to continue on failure, the output item will contain an error field describing the failure.

No binary data is produced by this operation.

Dependencies

  • Requires access to a Samba (SMB2) server.
  • Needs an API key credential or authentication token configured in n8n to connect securely to the SMB server.
  • Uses temporary file handling and streaming utilities internally but these are abstracted away from the user.

Troubleshooting

  • Common issues:

    • Incorrect SMB connection settings or insufficient permissions can cause failures.
    • Specifying invalid or non-existent old paths will result in errors.
    • Attempting to rename to a path where intermediate directories do not exist without enabling "Create Directories" option may fail.
  • Error messages:

    • "Failed to rename file: <error details>" indicates a problem during the rename operation. Check SMB credentials, permissions, and path validity.
    • If the node is set to continue on failure, errors will be included in the output item's error field instead of stopping execution.
  • Resolution tips:

    • Verify SMB server connectivity and credentials.
    • Ensure the old path exists and the new path is valid.
    • Enable "Create Directories" if the destination path includes directories that do not yet exist.

Links and References

Discussion