Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chriskrycho/bye
A tiny tool for 'deleting' big directories via $TMPDIR
https://github.com/chriskrycho/bye
Last synced: about 2 hours ago
JSON representation
A tiny tool for 'deleting' big directories via $TMPDIR
- Host: GitHub
- URL: https://github.com/chriskrycho/bye
- Owner: chriskrycho
- License: mit
- Created: 2022-02-02T16:45:30.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-02T16:54:54.000Z (almost 3 years ago)
- Last Synced: 2024-10-28T15:56:53.368Z (16 days ago)
- Language: Rust
- Size: 3.91 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `bye` :wave:
A trivial tool to get rid of a folder by moving it to `$TMPDIR` instead of deleting it (which is must faster than doing an `rm -rf`) and then letting the OS clean it up later. Adds a little random noise to the names to avoid collisions.
## Setup
1. Install Rust if you don't already have it.
```sh
brew install rustup-init
rustup-init
source $HOME/.cargo/env
rustup update stable
```2. Clone the repo and build it.
```sh
git clone [email protected]:chriskrycho/bye
cd bye
cargo build --release3. Put it somewhere on your PATH:
```sh
cp ./target/release/bye
```Now, you can just run `bye node_modules` and it'll get rid of it more or less instantaneously.
## Why/how
This is mostly useful for dealing with especially large directories with many files (e.g. `node_modules`): `rm -rf` can take a *long* time. This is more or less instantaneous on modern file systems, because it does not perform a copy or a “move”: it just changes where the link on the file system to that directory is.
You can do the same thing with `mv` yourself, of course:
```sh
mv node_modules $TMPDIR
```For a while that’s what I was doing. However, if you’re cleaning up folders with the same name over time, you can end up with name collisions—so then you need to add some kind of noise for the names. I got tired of that and wrote this.