Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Folders → Delete

AI-generated

Overview

The Folders → Delete operation in this custom n8n node for Directus allows you to delete a specific folder from your Directus instance by providing its unique ID. This is useful for automating the cleanup or management of folders within your Directus-managed assets, such as when removing obsolete directories or organizing your file storage.

Practical scenarios:

  • Automatically deleting temporary or outdated folders after processing files.
  • Integrating with workflows that manage digital assets and require dynamic folder removal.
  • Cleaning up user-generated folders as part of account deactivation processes.

Properties

Name Type Meaning
ID String Unique ID of the folder object to be deleted. Required. Example: 0fca80c4-d61c-4404-9fd7-6ba86b64154d

Output

  • The output will be a single item with a json field.
  • The structure of the json field depends on the response from the Directus API after attempting to delete the folder:
    • If successful, it typically returns an empty object {} or confirmation data.
    • If there is an error and "Continue On Fail" is enabled, the output will contain an error property with the error message, e.g.:
      {
        "error": "Folder not found"
      }
      

Dependencies

  • Directus API: Requires access to a Directus instance.
  • API Credentials: You must configure the directusApi credentials in n8n for authentication.

Troubleshooting

Common issues:

  • Invalid or missing ID: If the provided folder ID does not exist, the API will return an error (e.g., "Folder not found").
  • Insufficient permissions: The API credentials used must have permission to delete folders; otherwise, you may receive a "Forbidden" or "Unauthorized" error.
  • Folder not empty: Depending on Directus configuration, trying to delete a non-empty folder may result in an error.

Error messages and resolutions:

  • "Folder not found": Check that the ID is correct and the folder exists.
  • "Forbidden" or "Unauthorized": Ensure your API credentials have the necessary permissions.
  • Other errors: Review the error message in the output for more details.

Links and References

Discussion