Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/sindresorhus/trash-cli

Move files and folders to the trash
https://github.com/sindresorhus/trash-cli

Last synced: about 2 months ago
JSON representation

Move files and folders to the trash

Lists

README

        

# trash-cli

> Move files and folders to the trash

Works on macOS (10.12+), Linux, and Windows (8+).

In contrast to [`rm`](http://en.wikipedia.org/wiki/Rm_(Unix)) which is [dangerous](http://docstore.mik.ua/orelly/unix3/upt/ch14_03.htm) and permanently deletes files, this only moves them to the trash, which is much safer and reversible. I would also recommend reading my guide on [safeguarding `rm`](https://github.com/sindresorhus/guides/blob/main/how-not-to-rm-yourself.md#safeguard-rm).

Accepts paths and [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).

## Install

```sh
npm install --global trash-cli
```

## Usage

```
$ trash --help

Usage
$ trash […]

Examples
$ trash unicorn.png rainbow.png
$ trash '*.png' '!unicorn.png'
```

## Tip

Add `alias rm=trash` to your `.zshrc`/`.bashrc` to reduce typing & safely trash files: `$ rm unicorn.png`.

## [FAQ](https://github.com/sindresorhus/trash#faq)

## Related

- [trash](https://github.com/sindresorhus/trash) - API for this module
- [empty-trash-cli](https://github.com/sindresorhus/empty-trash-cli) - Empty the trash
- [del-cli](https://github.com/sindresorhus/del-cli) - Delete files and folders