delete-file¶
Delete one or more files.
Category: Write-capable
Warning
Deletions are permanent. This tool does not support undo or moving files to a trash folder.
Parameters¶
paths(required)- List of absolute paths of the files to delete. Relative paths are resolved against the current working directory.
Behavior¶
All paths are validated before any deletion begins:
- If any path does not exist or points to a directory, the entire request is rejected and nothing is deleted.
- Once validation passes, each file is deleted independently. A failure on one file (e.g. permissions) is recorded and deletion continues for the remaining files.
This tool does not support deleting directories. Use move-content to rename a directory out of the way, or delete its contents individually.
Output¶
A summary message: either a success count, or a success count with a list of files that could not be deleted and the reason for each failure.