E2B icon

E2B

Run commands and manage E2B sandboxes and snapshots

File → Delete

AI-generated

Summary

Delete a file or directory inside an E2B sandbox by specifying the sandbox ID and the path to the target file or folder.

Inputs

  • Sandbox ID (required) — ID of the sandbox to delete the file or folder from.
  • Path (required) — Path inside the sandbox of the file or folder to delete.
  • Timeout — Timeout in seconds to apply for the delete operation, defaults to 300 seconds.

Output shape

a single JSON object indicating success with fields sandboxId, path, and deleted set to true

Returns a confirmation that the file or folder at the specified path inside the given sandbox was deleted successfully. Throws an error if the deletion fails.

Examples

Example 1: Delete a file at /home/user/file.txt inside sandbox with ID abc123

Set Sandbox ID to 'abc123' and Path to '/home/user/file.txt'. Optional Timeout can be left as default or set as needed.

Links

Discussion