GitShow/sindresorhus/trash-cli
sindresorhus

trash-cli

Move files and folders to the trash

by sindresorhus
Star on GitHubForknpm

JavaScript

1.4k stars39 forks5 contributorsQuiet · 6mo agoSince 2015v7.2.0MIT

Meet the team

See all 5 on GitHub →
sindresorhus
sindresorhus43 contributions
jv-k
jv-k1 contribution
MoOx
MoOx1 contribution
Richienb
Richienb1 contribution

Languages

View on GitHub →
JavaScript100%

Commit activity

Last 12 weeks · 0 commits

Full graph →

Community health

4 of 6 standards met

Community profile →
85
✓README✓License✓Contributing✓Code of Conduct○Issue Template○PR Template

Recent PRs & issues

Quiet · 1 in progress · Last activity 6mo ago
See all on GitHub →
ahalekelly
Fix literal paths being silently ignoredOpenPR

On Windows, exits 0 but deletes nothing. Any input with backslash separators — or on any platform, a literal filename containing glob special characters like — is a silent no-op. Repro (Windows 11, trash-cli 7.2.0): Root cause: passes all input through globby, and fast-glob treats as a glob escape character, so backslash paths match zero files and gets an empty array. Fix: union the globby matches with literal input paths that exist per , then de-dupe — the same approach the package's own already uses (which is why calling the API directly is unaffected). Glob behavior is unchanged; only inputs that name an existing path are added. Testing: added a cross-platform AVA regression test (literal via , so it also exercises backslash separators on Windows). Manually verified on Windows 11: absolute/relative backslash paths, forward-slash paths, and plain filenames all land in the Recycle Bin with correct original locations; , , , and nonexistent-path behavior are unchanged; (xo + AVA) passes on Linux-equivalent paths. Known remaining gap (pre-existing, out of scope here):** a glob pattern whose directory portion uses backslashes () still matches nothing, since that genuinely reaches globby as a pattern. Fixing that would mean normalizing in patterns on Windows (e.g. fast-glob's or ), which changes escape semantics — left for a separate discussion. This is also why two of the existing tests ( ones, which build from a backslash base) fail on Windows both before and after this change; CI runs Ubuntu only, where the full suite passes. 🤖 Generated with Claude Code

ahalekelly · 2w ago

Recent fixes

View closed PRs →
wclr
--dot not supported?ClosedIssue

Seem option not supported yet?

wclr · 6mo ago
solrevdev
Directories are silently ignored (not trashed) due to globby onlyFiles defaultClosedIssue

Description silently fails to trash directories. The command returns exit code 0 but nothing is moved to trash. Steps to Reproduce ```bash mkdir test-folder echo "test" > test-folder/test.txt trash test-folder ls test-folder # folder still exists With --verbose, no output is produced either: trash -v test-folder (no output, folder still exists) Expected Behavior The directory should be moved to the trash. Actual Behavior The directory is silently ignored. Exit code is 0, no error message, no verbose output. Root Cause In cli.js line 49: const files = await globby(cli.input, {expandDirectories: false}); globby defaults to onlyFiles: true, which excludes directories from the results. When a directory path is passed, globby returns an empty array, so nothing gets trashed. Fix Add onlyFiles: false to the globby options: const files = await globby(cli.input, {expandDirectories: false, onlyFiles: false}); Environment trash-cli: 7.1.0 Node.js: v25.4.0 macOS: Tahoe 26.2 (25C56)

solrevdev · 7mo ago
karbassi
Verbose modeClosedIssue

It would be useful to have a flag for verbose mode. Usage

karbassi · 7mo ago
Structured data for AI agents

Repository: sindresorhus/trash-cli. Description: Move files and folders to the trash Stars: 1412, Forks: 39. Primary language: JavaScript. Languages: JavaScript (100%). License: MIT. Latest release: v7.2.0 (6mo ago). Open PRs: 1, open issues: 2. Last activity: 6mo ago. Community health: 85%. Top contributors: sindresorhus, jv-k, MoOx, Richienb.

·@ofershap

Replace github.com with gitshow.dev