https://github.com/westleyr/srm
Safe remove ('rm') command with caching and undo/recover
https://github.com/westleyr/srm
cache golang remove-with-undo rm safe safe-rm srm undo
Last synced: 3 months ago
JSON representation
Safe remove ('rm') command with caching and undo/recover
- Host: GitHub
- URL: https://github.com/westleyr/srm
- Owner: WestleyR
- License: bsd-3-clause-clear
- Created: 2019-12-18T03:54:34.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-02-01T20:54:14.000Z (about 1 year ago)
- Last Synced: 2025-02-01T21:34:32.710Z (about 1 year ago)
- Topics: cache, golang, remove-with-undo, rm, safe, safe-rm, srm, undo
- Language: Go
- Homepage:
- Size: 2.49 MB
- Stars: 8
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Safe Remove (`rm`) command with cache/undo
This is a `rm` command imitation, but without actually removing anything, only
moving it into cache (`~/.cache/srm3`). By doing this, you can recover
accidentally-removed files.
## Install
If you have go installed, then you can run:
```
GOPROXY=direct go install github.com/WestleyR/srm@main
```
Or via clone:
```
git clone https://github.com/WestleyR/srm
cd srm/
make
sudo make install # Or without root: 'make install PREFIX=${HOME}/.local'
```
### Aliasing
Optional to add this to your `~/.bashrc` or `~/.bash_profile`:
```
alias rm="srm"
```
### Linking
Instead or addition to aliasing, you can symlink srm -> rm in a first-search
path directory.
```
$ echo $PATH
/usr/local/sbin:/usr/local/bin ...
# ln -s /usr/local/bin/srm /usr/local/sbin/rm
```
This way, `rm` will always run `srm`, even for other users. You can always run
the normal `rm` by calling `/bin/rm ...`.
## Disclaimer
This is not designed to be a foolproof rm command, you still need to be careful.
## License
This project is licensed under the terms of The Clear BSD License. See the
[LICENSE file](./LICENSE) for more details.