delete_file
Delete files or directories in the workspace. This tool provides a secure alternative to the rm command and supports cross-platform operation.
Parameter Description
path(required): Relative path of the file/directory to be deleted
Function Description
This tool supports secure deletion operations with user confirmation. When deleting directories, it first verifies all contained files and displays statistical information before executing deletion.
Safety Features
- Only delete files/directories within the workspace
- Deletion operations require user confirmation
- Prohibit deletion of write-protected files
- Validate all files to be deleted according to
.vjspignorerules - Directory deletion scenario: recursively scan directories, display statistics such as number of files, number of directories, total size, etc. before deletion
- If the directory contains protected/ignored files, the entire directory deletion operation will be blocked
Usage
Delete a Single File
xml
<delete_file>
<path>temp/old_file.txt</path>
</delete_file>Delete a Directory
xml
<delete_file>
<path>old_project/</path>
</delete_file>When deleting a directory, the tool will execute the following process:
- Recursively scan the target directory
- Verify that all files meet the deletion conditions
- Display summary information including number of files, number of subdirectories, and total size
- Execute the deletion operation after waiting for user confirmation
Exception Handling
The tool returns clear error messages for the following scenarios:
- The file/directory to be deleted does not exist
- The file is write-protected
- The file is blocked by
.vjspignorerules - The directory contains protected/ignored files
- The target path is outside the workspace
