Alternative tool for rm command in linux using python
- Btrm stand for "backup then remove", this project aim to replace build-in command rm in Unix system.
- The rm -rf command is one of the fastest way to delete a folder and its contents. But a little typo or ignorance may result into unrecoverable system damage. So we decide to built our alternative tool to remove file but with backup mechanism.
- python 2.7+
- pip
pip install --user btrm
- add
export PATH="$HOME/.local/bin:$PATH"
to .bashrc or .zshrc(if your shell is using zsh)
- Edit default config at ~/.config/btrm.conf
usage: btrm [OPTION]... [FILE]...
Alternative tool for rm command in linux using python
positional arguments:
filename directory or file you want to delete
optional arguments:
-h, --help show this help message and exit
-i prompt before removal (default)
-f, --force force delete without promt
-r, -R, --recursive remove directories and their contents recursively
--no-backup remove without backup mechanism (can not recover later)
--recover recover file from trash
--list-trash show list deleted file, sort by date time
--wipe-all complete delete everything from recycle bin, free disk
space
-v, --version show version information and exit
By default, btrm does not remove directories. Use the --recursive (-r or -R)
option to remove each listed directory, too, along with all of its contents.
To remove a file whose name starts with a '-', for example '-foo',
use one of these commands:
btrm -- -foo
btrm ./-foo
Note that if you use btrm to remove a file, it always be possible to recover all
of its contents within 60 days, looking for deleted file at trash directory and
and use --recover options to recover whatever you want. For greater assurance
that the contents are truly unrecoverable, consider using shred.
- Remove directory xyz and abc
- show list removed file
- recover directory xyz and abc