Overview
This node allows you to delete files or folders on a Samba (SMB2) server. It connects to the SMB server and removes the specified file or folder based on the provided path. This operation is useful for automating cleanup tasks, managing remote file storage, or integrating SMB file management into workflows.
Practical examples:
- Automatically deleting temporary files after processing.
- Removing outdated reports or logs from a shared network drive.
- Cleaning up user-uploaded files after a certain period.
Properties
| Name | Meaning |
|---|---|
| Path | The full file path of the file or folder to delete. Example: /public/documents/file-to-delete.txt |
| Options | Collection of additional options: - Folder: Boolean indicating whether folders can be deleted ( true or false). |
Output
The output consists of an array of JSON objects corresponding to each input item processed. For the delete operation, the output JSON reflects the original input data with no additional fields added upon successful deletion.
If an error occurs during deletion and "Continue On Fail" is enabled, the output JSON for that item will include an error field describing the failure reason.
No binary data is produced by this operation.
Dependencies
- Requires connection credentials to access the SMB2 server (an API key or authentication token configured in n8n).
- Uses the SMB2 protocol to communicate with the remote file system.
- No additional external services are required beyond the SMB2 server.
Troubleshooting
Common issues:
- Incorrect file or folder path: Ensure the full path is correct and accessible.
- Insufficient permissions: The SMB user must have delete rights on the target file/folder.
- Attempting to delete a folder without enabling the "Folder" option.
- Network connectivity problems with the SMB server.
Error messages:
"Failed to delete file: <error message>": Indicates a problem deleting the specified file. Check path correctness and permissions."Failed to delete folder: <error message>": Occurs if trying to delete a folder without the folder option enabled or due to permission issues.
Resolutions:
- Verify the path and ensure it exists on the SMB share.
- Enable the "Folder" option if deleting directories.
- Confirm the SMB credentials have sufficient privileges.
- Check network connectivity and SMB server availability.
Links and References
- Samba (SMB) Protocol Overview
- n8n Documentation - Creating Custom Nodes
- Node.js fs module (used internally for temporary file handling)