home / file-management / trash-cli

trash-cli

1.4k

Safe-delete CLI for moving files and folders to the system trash instead of removing them permanently.

$npm install -g trash-cli
Language
JavaScript
Stars
1,388
Agent
AI Analysis

trash-cli is a small cross-platform CLI that moves files and folders to the system trash instead of removing them permanently. It covers one narrow job, but that job matters in shell workflows where agents or scripts need a safer alternative to rm.

What It Enables
  • Trash files, folders, and quoted glob matches from scripts without bypassing the OS recycle or trash mechanism.
  • Replace risky cleanup steps with a reversible delete primitive for generated files, temp assets, or other local content.
  • Print trashed paths with --verbose when a script needs a minimal audit trail of what was moved.
Agent Fit
  • Path-based arguments, straightforward flags, and non-interactive execution make it easy to drop into cleanup scripts and agent loops.
  • The automation surface is intentionally small: there is no JSON output, no built-in list or restore command, and no broader filesystem inspection features.
  • Best used as a safety layer around destructive local file operations when human recovery from mistakes still matters.
Caveats
  • It ignores common rm flags for compatibility, but it does not implement full rm semantics or richer file-management workflows.
  • Glob patterns should be quoted, and dotfiles require --dot to be matched.