Overview
This node enables file and folder operations on a Samba (SMB2) server, allowing users to interact with remote SMB shares. The "Rename" operation specifically renames or moves a file or folder from an old path to a new path on the SMB share.
Common scenarios for this node include:
- Organizing files on a network share by renaming or moving them.
- Automating file management tasks such as archiving or restructuring directories.
- Integrating SMB file operations into workflows that require remote file manipulation.
For example, you could rename /public/documents/old-file.txt to /public/documents/new-file.txt to reflect updated document names 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 reflects the original input data without modification unless an error occurs.
If an error happens 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 reason.
No binary data is produced by the rename operation.
Dependencies
- Requires access to a Samba (SMB2) server with appropriate permissions to rename files or folders.
- Needs an API key credential or authentication token configured in n8n to connect securely to the SMB server.
- Uses internal helper functions to establish the SMB connection and perform file operations.
Troubleshooting
Common issues:
- Insufficient permissions on the SMB share to rename or move files/folders.
- Specified old path does not exist.
- Destination directory does not exist and
Create Directoriesoption is false. - Network connectivity problems with the SMB server.
Error messages:
"Failed to rename file: <error details>"— Indicates the rename operation failed. Check SMB connection settings, file/folder permissions, and ensure paths are correct.- If continuing on fail is enabled, errors are returned in the output JSON under the
errorproperty for each failed item.
Resolution tips:
- Verify the SMB credentials and network accessibility.
- Confirm the old path exists and is accessible.
- Enable the
Create Directoriesoption if the new path's parent directories might not exist. - Review SMB server logs for permission or access errors.
Links and References
- Samba (SMB) Protocol Overview
- n8n Documentation - Creating Custom Nodes
- Node.js fs module (for understanding file system streams used internally)