Overview
This node enables file and folder operations on a Samba (SMB2) server, specifically supporting actions such as listing directory contents, downloading files, uploading files, deleting files or folders, and renaming/moving files or folders. The "Rename" operation allows users to rename or move a file or folder from an old path to a new path on the SMB share.
Common scenarios for this node include automating file management tasks on network shares, integrating SMB file storage with workflows, or migrating/organizing files remotely without manual intervention.
For example, you could use the Rename operation to move a file from an "inbox" folder to an "archive" folder after processing it, or to rename files based on workflow results.
Properties
| Name | Meaning |
|---|---|
| Old Path | The full current path of the file or folder to rename/move. Example: /public/documents/old-file.txt |
| New Path | The full new 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 items generally contain the original input data unchanged unless an error occurs.
If the rename operation succeeds, the output JSON reflects the input item without modification.
If an error occurs during renaming, the output JSON includes an error field describing the failure.
No binary data is produced by the Rename 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 perform file operations.
- No external services beyond the SMB server are required.
Troubleshooting
Common issues:
- Incorrect SMB server credentials or network connectivity problems.
- Insufficient permissions to rename or move files/folders on the SMB share.
- Specifying invalid or non-existent paths for old or new locations.
- Destination directory does not exist and
Create Directoriesoption is false.
Error messages:
"Failed to rename file: <error message>"indicates the rename operation failed due to permission issues, missing source file, or other SMB errors.- Check your SMB connection settings and file permissions if you encounter errors.
- Enabling the
Create Directoriesoption can help avoid errors related to missing destination directories.
How to resolve:
- Verify SMB credentials and network access.
- Confirm that the old path exists and is accessible.
- Ensure the new path's parent directories exist or enable the option to create them automatically.
- Use the node's "Continue On Fail" feature to handle errors gracefully in workflows.
Links and References
- Samba (SMB) Protocol Overview
- n8n Documentation on Creating Custom Nodes
- Node.js fs module documentation (for understanding file streams used internally)