Skip to content

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

  1. Only delete files/directories within the workspace
  2. Deletion operations require user confirmation
  3. Prohibit deletion of write-protected files
  4. Validate all files to be deleted according to .vjspignore rules
  5. Directory deletion scenario: recursively scan directories, display statistics such as number of files, number of directories, total size, etc. before deletion
  6. 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:

  1. Recursively scan the target directory
  2. Verify that all files meet the deletion conditions
  3. Display summary information including number of files, number of subdirectories, and total size
  4. 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 .vjspignore rules
  • The directory contains protected/ignored files
  • The target path is outside the workspace