Samba (SMB2) icon

Samba (SMB2)

Transfer files via Samba (SMB2)

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 options:
Folder: Boolean indicating whether folders can be deleted (true or false).

Output

The output is an array of JSON objects corresponding to each input item processed. Each object contains the original input data, possibly augmented with an error field if the deletion failed for that item.

  • On successful deletion, the output item is essentially unchanged.
  • On failure, the output item's json.error field contains a descriptive error message explaining why the deletion failed.

No binary data is output by this node.

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 share.
  • No additional external services are required beyond the SMB server itself.

Troubleshooting

  • Common issues:

    • Incorrect file path or missing full path will cause failures.
    • Attempting to delete a folder without enabling the "Folder" option.
    • Insufficient permissions on the SMB server to delete the specified file or folder.
    • Network connectivity problems to the SMB server.
  • Error messages:

    • "Failed to delete file: <error details>" — Indicates the deletion failed; check the path, permissions, and SMB connection.
    • If the node is set to continue on fail, errors are returned in the output's json.error field instead of stopping execution.
  • Resolutions:

    • Verify the full path is correct and accessible.
    • Enable the "Folder" option if deleting directories.
    • Ensure the SMB credentials have delete permissions.
    • Check network connectivity and SMB server availability.

Links and References

Discussion