redo

Command line based trash manager: remove, restore and list trashed files

Download as .zip Download as .tar.gz View on GitHub

Install

As redo is a set of plain bash scripts, no install is required, just cp re trash /usr/local/bin, ln -s $(pwd)/re $(pwd)/trash /usr/local/bin or export PATH=$PATH:$(pwd).

Usage

redo is composed of two commands.

re

Move elements (file, directory, ...) to trash.

re myfile.txt /my/directory ../apic.png

Name collision are handled correctly, you won’t lose your file!

$ touch foo
$ re foo
$ touch foo
$ re foo
$ trash list
ID      Trash Date                      Restore path
---------------------------------------------------------------
0        Sun Sep 13 12:31:55 CEST 2015  /Users/alj/Code/redo/foo
1        Sun Sep 13 12:31:57 CEST 2015  /Users/alj/Code/redo/foo

trash

Display, restore and empty trash.

Available actions:

$ mkdir foo
$ touch bar
$ touch baz
$ re foo bar baz
$ trash list
ID      Trash Date                      Restore path
---------------------------------------------------------------
0        Sun Sep 13 12:22:14 CEST 2015  /Users/alj/Code/redo/bar
1        Sun Sep 13 12:22:14 CEST 2015  /Users/alj/Code/redo/baz
2        Sun Sep 13 12:22:14 CEST 2015  /Users/alj/Code/redo/foo
$ trash restore 0
$ trash list
ID      Trash Date                      Restore path
---------------------------------------------------------------
0        Sun Sep 13 12:22:14 CEST 2015  /Users/alj/Code/redo/baz
1        Sun Sep 13 12:22:14 CEST 2015  /Users/alj/Code/redo/foo
$ trash remove 1
$ trash list
ID      Trash Date                      Restore path
---------------------------------------------------------------
0        Sun Sep 13 12:22:14 CEST 2015  /Users/alj/Code/redo/baz
$ trash empty
$ trash list
ID      Trash Date                      Restore path
---------------------------------------------------------------