Skip to content

Isfand/trash

Repository files navigation

Trash Manager

Summary

This project is a cross-platform file trashing utility for the terminal that can reverse file deletion.

Tested on Linux, FreeBSD & Windows.
See docs/ for more information.

Pre-built binaries:

Release binaries are provided for Linux and FreeBSD.

Build Pre-requisites:

*Requires the build2-toolchain to be pre-installed. See https://build2.org/install.xhtml
*Requires c++23 supporting compiler.
(Optional): For building compilation database use latest staged toolchain.

Build Instructions:

mkdir trash.d
cd trash.d
git clone https://github.com/Isfand/trash.git
cd trash

POSIX: ./config-init.sh
WIN32: .\config-init.ps1

bdep update -a

This should build all initialized build configurations.
To list all build configs, type: bdep config list
To clean all build configs and dependencies recursively, type: bdep clean -a -r
To update a specific config: bdep update @<config-name>
To clean a specific config: bdep clean @<config-name>

Install

POSIX:

cd into your release target build configuration directory. E.G: cd ../trash-x64-posix-llvm-release

And type:
b install config.cxx.loptions="-L/usr/local/lib -Wl,-rpath,/usr/local/lib" config.install.root="/usr/local/" config.install.sudo="sudo"

To uninstall just replace install with uninstall for the command above.

This should work on any POSIX compliant platform.

WIN32:

WIP

Basic usage:

*Note, '--help' option changes message when applied after a primary command:

trash --version | 
trash --help    | -h

Primary commands

delete   | d
list     | l
restore  | r
erase    | e
validate | v

Deleting files:

trash delete filename
trash delete -- filename

Listing files:

trash list, List all by default

Restoring files:

trash restore <n>
trash restore --all | -a, Restore all

Erasing files:

trash erase <n>
trash erase --all | -a, erase all

Validating files:

trash validate --all | -a, Validate all

Environment variables:

TRASH_DIR
The directory where the trash/ folder will be located. Defaults to '$HOME/.trash/'. The directory filename before the last delimiter will be used as the root of the trash directory name. E.G 'export TRASH_DIR=/home/user/.local/shared/.trashAlt/', will make .trashAlt/ become the trash directory name.


If you find the program useful then consider donating