Samba (SMB2) icon

Samba (SMB2)

Transfer files via Samba (SMB2)

Overview

This node enables file and folder operations over the Samba (SMB2) protocol, allowing interaction with SMB shares. The "Rename" operation specifically renames or moves a file or folder from an old path to a new path on the SMB server.

Common scenarios for this node include:

  • Organizing files on a network share by renaming or moving them.
  • Automating file management tasks in environments using SMB shares.
  • Integrating SMB file operations into workflows that require remote file manipulation.

For example, you can rename /public/documents/old-file.txt to /public/documents/new-file.txt to reflect updated naming conventions or move files between folders.

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 where the file or folder should be renamed/moved to. 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. Defaults to false.

Output

The output is an array of JSON objects corresponding to each input item processed. For the rename operation, the output JSON simply returns the original input data unchanged if successful.

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

No binary data is produced by the rename operation.

Dependencies

  • Requires access to an SMB2-compatible server.
  • Needs valid SMB credentials configured in n8n to authenticate and connect to the SMB share.
  • Uses temporary file handling and streaming utilities internally but these are abstracted away from the user.

Troubleshooting

  • Common issues:

    • Incorrect SMB server address or credentials causing connection failures.
    • Insufficient permissions to rename files or create directories on the SMB share.
    • Specifying invalid or non-existent paths for old or new locations.
    • Destination directory does not exist and Create Directories option is not enabled.
  • Error messages:

    • "Failed to rename file: <error message>" indicates the rename operation failed. Check SMB connection settings, file/folder permissions, and path correctness.
    • If the node is set to continue on fail, errors will appear in the output JSON under the error key for the affected items.

Links and References

Discussion