rem
is a quick and simple recycle bin, I've tried a few other scripts and they were clunky and, at times, a little broken.
The simplicity of rem
is in its core functionality, it base64 encodes full filepaths and moves them to a storage location ($STORE_DIR
), that's it.
At runtime, the contents of this location are taken and decoded and a list of the removed files can be used.
Included is a simple install script which will symlink rem
to a suitable location on your PATH
.
If you wish to copy the file, pass "install"
as the first argument to this script
git clone https://github.com/BodneyC/rem.git
cd rem
./install.sh # "install"
Currently using the BATS testing framework added as submodules, so either clone with:
git clone --recurse-submodules https://github.com/BodneyC/rem.git
or initialise them with:
git submodule update --init --recursive
then:
./rem.bats.bash
to run the tests.
There are six subcommands (used as rem {subcommand}
):
remove
: Moves the given file to the storage locationdelete
: Which deletes files in the storage locationrestore
: Which restores files from the storage locationsearch
: List files in the storage location matching agrep
patternresearch
(res
tore viasearch
): This first performs a search and if any results are found, restores themclean
: Empty the storage locationlast
: Will restore the last fileremove
ed
search
can be useful when r
es
toring to save writing full paths, eg:
$ rem rs $(rem sr "myfile")
alternatively, rem research
can be used
$ rem rr "myfile"
this will [yn]
prompt you, if you don't want this, pass -y
to automatically select 'yes'.
Nothing more to it really.
Rem, a simple recycle bin script; usage:
rem [(--help|--version|--no-colors|--yes|--quiet)]
(remove|restore|research|delete|clean|search)
[<args>]
Options:
-h|--help: show this help information
-s|--version: show version information
-n|--no-colors: disable color output
-y|--yes: disable prompts with 'yes'
-q|--quiet: disable prompts and output (with 'no')
Subcommands:
remove:
aliases: rm, rem, remove
desc: moves specified file(s) to $STORE_DIR
restore:
aliases: rs, res, restore
desc: restore file(s) from $STORE_DIR (args either with or without
$STORE_DIR prefix)
delete:
alias: dl, del, delte
desc: delete files from $STORE_DIR
search:
aliases: sr, sear, search
desc: search files added to $STORE_DIR, grep expressions as optional args
research:
aliases: rr, resear, rrch
desc: restore via search, file(s) from $STORE_DIR (args either with or
without $STORE_DIR prefix)
clean:
aliases: cl, cln, clean
desc: empty $STORE_DIR, you will be prompted for assurance