Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/var7600/rm-secure
https://github.com/var7600/rm-secure
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/var7600/rm-secure
- Owner: Var7600
- Created: 2024-12-05T23:30:14.000Z (17 days ago)
- Default Branch: main
- Last Pushed: 2024-12-06T00:26:01.000Z (17 days ago)
- Last Synced: 2024-12-06T00:27:15.747Z (17 days ago)
- Language: Shell
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rm-secure
![logo](https://github.com/user-attachments/assets/1e9c424b-1a76-487a-a131-1fe07c521fdf)
![Screenshot 2024-12-05 183535](https://github.com/user-attachments/assets/71e9f9aa-240d-4590-82b7-95edf5da68c5)
yet Another alternative for the `Evil /bin/rm` command in Linux that provides
options for backup, retention, and restoration of deleted file(s) or
directory/ies.[![CI - ShellCheck and Bats](https://github.com/Var7600/rm-secure/actions/workflows/ci.yml/badge.svg)](https://github.com/Var7600/rm-secure/actions/workflows/ci.yml)
## Installation
1.Clone the Repository
```bash
git clone https://github.com/Var7600/rm-secure.git
cd rm-secure/
```## Install Dependencies
2.Ensure you have the following installed:
- `shellcheck` for linting (optional for users but required for contributing)
- `Bats` for testing (optional for users but required for contributors)For Debian/Ubuntu:
```bash
sudo apt install shellcheck bats
```
For macOS (via Homebrew):
```bash
brew install shellcheck bats
```3.Make the Script Executable
```bash
chmod +x rm-secure.sh
```4.add script path to `.bashrc`
```bash
source path/to/file/rm-secure.sh
```5.Add rm-secure.sh Path to `.bashrc`
```bash
export PATH="$PATH:path/to/file/"
```
- or rather than replacing built in `rm` you can use `rm-secure.sh`
```bash
sudo cp rm-secure.sh /usr/local/bin/rm-secure
```
Now, you can use rm-secure as a command instead of rm.## Usages
```bashrm_secure: A safer alternative to GNU rm
Usage: rm [OPTIONS] FILE...
Options:
-d Set retention period in days (default: 60 days)
-e, --empty Empty the trash folder
-l, --list List files in the trash folder
-s, --restore Restore files or directory from trash
-r/-R, --delete delete a directory
-v, --verbose Verbose output
--help Show this help message
```- delete file
```bash
>$ rm test.cpp
renamed 'test.cpp' -> '/home/var7600-unix/rm_saved/2024_12_03_22h08m_test.cpp'
saved for 60 days
```- list deleted file(s)
```bash
>$ rm -l
total 0
-rw-r--r-- 1 var7600-unix var7600-unix 337 Dec 3 22:09 2024_12_03_22h08m_test.cpp
```- restore file(s)
```bash
>$ rm -s test.cpp
renamed '/home/var7600-unix/rm_saved/2024_12_03_22h08m_test.cpp' -> './2024_12_03_22h08m_test.cpp'
```- empty trash definitively
```bash
>$ rm -e
```- deleting a directory use `-r` or `-R` option
```bash
>$ rm -r Scripts
deleting Scripts/ (Saved in ~/home/var7600/rm_saved/)
saved for 60
```- restore directory
```bash
>$ rm -s Scripts
```## Notes
- Ensure that the `sauvegarde_rm` directory is accessible and writable (default is `~/rm-saved/`).
- This script overrides `rm` behavior and moves files to a temporary location instead of deleting them permanently.## TO DO
- [ ] make a `-d` or `--days` option to specify the number of days to save the deleted file.## Contributions
all Contributions bug/reports/issues/pull request are welcome.
Clone the repository and set up dependencies.1.write your features or fix or ...
2.Run ShellCheck to lint the script:
```bash
shellcheck rm-secure.sh
```
3. add yours tests and Run Bats to test
```
bats tests/
```## License
MIT License.