delete

Safe file removal via Trash

Go File System GitHub

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@latest

The 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

MetricValue
RecoveryAlways recoverable from Trash
SafetyBlocks system paths automatically
Replacesrm, rmdir, rm -rf