Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Folders → Delete Multiple

AI-generated

Overview

The Folders → Delete Multiple operation in this n8n node allows you to delete multiple folders at once from a Directus instance. This is particularly useful for bulk management tasks, such as cleaning up unused folders or automating the removal of several folders as part of a workflow.

Practical scenarios:

  • Cleaning up test or temporary folders after a batch process.
  • Automating the deletion of user-specific folders when users are removed.
  • Managing content structures by removing obsolete folder groups in one action.

Properties

Name Type Meaning
Keys (JSON) json An array of folder primary keys. Each key uniquely identifies a folder to be deleted.

Example value:

["d97c2e0e-293d-4eb5-9e1c-27d3460ad29d", "fc02d733-95b8-4e27-bd4b-08a32cbe4e66"]

Output

  • The output will be a single item with a json field containing the response from the Directus API after attempting to delete the specified folders.
  • The structure of the json field depends on the Directus API's response, but typically it will confirm which folders were deleted or provide status information.
  • If an error occurs and "Continue On Fail" is enabled, the output will contain an error property with the error message.

Example output:

{
  "json": {
    // Success: could be an object with details about the deleted folders,
    // or simply a confirmation/status message depending on Directus configuration.
  }
}

or, on error:

{
  "json": {
    "error": "Error message describing what went wrong"
  }
}

Dependencies

  • Directus API: You must have access to a running Directus instance.
  • API Credentials: The node requires valid Directus API credentials (directusApi) configured in n8n.
  • Permissions: The authenticated user must have permission to delete folders in Directus.

Troubleshooting

Common issues:

  • Invalid Keys: If any provided folder key does not exist, the API may return an error.
  • Permission Denied: If the API credentials lack sufficient permissions, deletion will fail.
  • Malformed JSON: The "Keys (JSON)" property must be a valid JSON array of strings; otherwise, parsing errors will occur.

Common error messages:

  • "Invalid JSON": Ensure the input is a properly formatted JSON array.
  • "Permission denied": Check your Directus user's permissions.
  • "Folder not found": One or more keys do not correspond to existing folders.

Links and References

Discussion