delete
Safe file removal via Trash
Move files and directories to macOS Trash instead of permanently deleting. Blocks system paths and handles name collisions with timestamp suffixes.
Features
- Moves to $HOME/.Trash instead of permanent deletion
- Blocks system paths (/System, /usr, /bin, etc.)
- Handles name collisions with timestamp suffix
- Reports original path, trash path, type, and size
- Works on files, directories, and symlinks
Install
go install github.com/hegner123/delete@latestThe Problem: rm is permanent and dangerous for AI agents
# AI agent runs: rm -rf ./build/
# Oops, that was the wrong directory.
# No undo. No recovery. Data gone.
#
# Even worse: rm -rf with a bad variable expansion
# could wipe important files.Solution
$ delete --cli ./build/Output
{"original_path":"/Users/dev/project/build","trash_path":"/Users/dev/.Trash/build","type":"directory","size":15728640,"items":342}Comparison
| Metric | Value |
|---|---|
| Recovery | Always recoverable from Trash |
| Safety | Blocks system paths automatically |
| Replaces | rm, rmdir, rm -rf |