Actions100
- Activity Actions
- Asset Actions
- Authentication Actions
- Collection Actions
- Extension Actions
- Field Actions
- File Actions
- Folder Actions
- Item Actions
- Permission Actions
- Preset Actions
- Relation Actions
- Revisions Actions
- Roles Actions
- Settings Actions
- Users Actions
- Utilities Actions
Overview
The Directus - Folder: Delete operation in this n8n node 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 file storage, such as removing obsolete directories or organizing assets programmatically.
Practical scenarios:
- Automatically deleting temporary or outdated folders after processing files.
- Integrating with other workflows that require dynamic folder management in Directus.
- Cleaning up resources as part of a data archival or migration process.
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:- On success, it typically returns an empty object
{}
or confirmation data. - On failure (if "Continue On Fail" is enabled), it returns an object like
{ "error": "<error message>" }
.
- On success, it typically returns an empty object
Example output:
{
"json": {}
}
or, if there is an error and "Continue On Fail" is enabled:
{
"json": {
"error": "Folder not found"
}
}
Dependencies
- Directus API: Requires access to a running Directus instance.
- API Credentials: You must configure the
directusApi
credentials in n8n for authentication. - n8n Configuration: No additional environment variables are required beyond standard credential setup.
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 folder that contains files or subfolders may fail.
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."Cannot delete non-empty folder"
: Remove all contents from the folder before deletion.