Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

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

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

Last synced: 27 days ago
JSON representation

Move files and folders to the trash

Awesome Lists containing this project

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 package
- [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