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 File → Delete Multiple operation in this n8n node allows you to delete multiple files from a Directus instance in a single workflow step. This is particularly useful when you need to perform batch deletions, such as cleaning up unused assets, removing outdated documents, or managing file storage efficiently.
Practical examples:
- Deleting a list of files that were flagged for removal by a previous automation.
- Cleaning up temporary files after processing.
- Bulk-removing user-uploaded files based on certain criteria.
Properties
Name | Type | Meaning |
---|---|---|
Keys (JSON) | JSON | An array of primary keys (IDs) of the files you want to delete. Example: ["id1", "id2"] |
Output
- The output will be an object in the
json
field containing the response from the Directus API after attempting to delete the specified files. - The structure of the output depends on the Directus API's response, but typically it may include:
- A summary of deleted items
- Any errors encountered during deletion
- Confirmation of successful deletion
Example output:
{
"json": {
// Response data from Directus, e.g.,
"data": [
{ "id": "b6123925-2fc0-4a30-9d86-863eafc0a6e7", "status": "deleted" },
{ "id": "d17c10aa-0bad-4864-9296-84f522c753e5", "status": "deleted" }
]
}
}
If an error occurs and "Continue On Fail" is enabled, the output may look like:
{
"json": {
"error": "Error message here"
}
}
Dependencies
- Directus API: You must have access to a Directus instance with appropriate permissions to delete files.
- API Credentials: The node requires valid Directus API credentials configured in n8n under the name
directusApi
.
Troubleshooting
Common issues:
- Invalid or missing file IDs: If any of the provided keys do not correspond to existing files, the API may return an error for those entries.
- Insufficient permissions: The API credentials used must have permission to delete files; otherwise, the operation will fail.
- Malformed JSON: The "Keys (JSON)" property must be a valid JSON array of strings. Invalid JSON will cause the node to throw a parsing error.
Common error messages:
"Invalid credentials"
: Check your Directus API credentials configuration."File not found"
: One or more IDs do not exist in the Directus files collection."Permission denied"
: Ensure the API user has delete rights for files."Unexpected token"
: Indicates malformed JSON in the "Keys (JSON)" input.