AIGC网盘 - 批量删除文件

批量删除AIGC网盘中的多个文件,支持安全确认和删除统计

Overview

This node enables batch deletion of multiple files stored in the AIGC Network Disk service. It is designed to securely and efficiently remove a list of files by their IDs, supporting both numeric and string identifiers. The node requires explicit user confirmation before proceeding with deletion to prevent accidental data loss.

Common scenarios for this node include:

  • Cleaning up large numbers of obsolete or temporary files in bulk.
  • Automating file management workflows where multiple files need to be deleted after processing.
  • Enforcing storage quotas by removing unwanted files programmatically.

For example, a user can input a comma-separated list of file IDs such as 1,2,3,4 or abc123,def456,ghi789, confirm the deletion, and the node will attempt to delete all specified files in one operation, returning statistics about success and failure counts.

Properties

Name Meaning
文件ID列表 (fileIds) Comma-separated list of file IDs to delete. Supports both numeric and string IDs. Example: 1,2,3,4 or abc123,def456,ghi789.
确认删除 (confirmDeletion) Boolean flag to confirm batch deletion. Must be set to true to proceed, as deletion is irreversible.

Output

The node outputs a JSON object for each input item containing:

  • success: Boolean indicating if the batch deletion request was successful.
  • data: Raw response data from the API call.
  • operation: The string "batchDeleteFiles".
  • statistics: An object summarizing the deletion results:
    • total: Total number of requested files.
    • success: Number of files successfully deleted.
    • failed: Number of files that failed to delete.
    • successRate: Percentage of successful deletions formatted as a string with one decimal place.
  • requested_files: Array of file IDs that were requested for deletion.
  • message: Human-readable summary message indicating overall success or partial failure.

If any error occurs during execution, the node throws an error with a descriptive message, or if configured to continue on fail, it outputs an error object alongside the item index.

The node does not output binary data.

Dependencies

  • Requires an API key credential for authenticating requests to the AIGC Network Disk API.
  • The node uses an HTTP DELETE request to the endpoint /api/files/batch with a JSON body containing the list of file IDs.
  • Proper configuration of the API credential within n8n is necessary for successful authentication.

Troubleshooting

  • Missing Confirmation: If the "确认删除" (confirmDeletion) property is not set to true, the node will throw an error asking the user to confirm deletion to avoid accidental data loss.
  • Empty or Invalid File ID List: Errors are thrown if the file ID list is empty, contains only whitespace, or no valid IDs are found after parsing.
  • Batch Size Limit: The node enforces a maximum of 100 files per batch deletion. Attempting to delete more than 100 files at once will result in an error.
  • API Errors:
    • HTTP 400: Indicates invalid request parameters, likely due to malformed file IDs.
    • HTTP 401: Authentication failure due to invalid or expired API token.
    • HTTP 403: Permission denied, possibly because the user tries to delete files they do not own.
    • HTTP 5xx: Server-side errors; users should retry later.
  • Users should ensure the file IDs are correct and that the API credentials have sufficient permissions to delete the specified files.

Links and References

  • No external links provided in the source code. For further details, consult the AIGC Network Disk API documentation or your organization's internal API references.

Discussion