#Why?
Did you ever do rmdir -p /etc/udev/emptydir
?
Did you ever do rm -rf some-important-dir
?
Did you ever do rm important-file
?
I even deleted all my local changes while testing this software without solution. 😢
So I think it's a must for regular desktop use nowadays.
#How?
It's a fork of rmtrash but:
- Based on unitary tests ( bats )
- Oficial coreutils tests translated to bats
- Integrated with travis
- Complete rework of code
#Install Clone the repo in your $PATH dir and alias it, for example:
cd ~/Clones
git clone https://github.com/liloman/rmalias
ln -s $PWD/rmalias/rmdiralias ~/.local/bin/rmdiralias
echo 'alias rmdir="rmdiralias -v"' >> ~/.bashrc
In order to work you need to install trash-cli. For fedora:
dnf install trash-cli
#Oh wait! I got f*****! (frowning upon)
It's a wrapper for trash-cli so you can rollback any deleted file.
##List trashed files
$ trash-list
2008-06-01 10:30:48 /home/andrea/bar
2008-06-02 21:50:41 /home/andrea/bar
2008-06-23 21:50:49 /home/andrea/foo
##Restore a trashed file
$ trash-restore
0 2007-08-30 12:36:00 /home/andrea/foo
1 2007-08-30 12:39:41 /home/andrea/bar
2 2007-08-30 12:39:41 /home/andrea/bar2
3 2007-08-30 12:39:41 /home/andrea/foo2
4 2007-08-30 12:39:41 /home/andrea/foo
What file to restore [0..4]: 4
$ ls foo
foo
##Empty all the trashcan
$ trash-empty
##Empty only the files that have been deleted before ago
$ trash-list
2008-02-19 20:11:34 /home/einar/today
2008-02-18 20:11:34 /home/einar/yesterday
2008-02-10 20:11:34 /home/einar/last_week
$ trash-empty 7
$ trash-list
2008-02-19 20:11:34 /home/einar/today
2008-02-18 20:11:34 /home/einar/yesterday
##Remove only files matching a pattern
$ trash-rm *.o
#TODO
##General
- You can't trash the trashcan
- Handle ERRORs from trash-put like not trashcan ...
- Patch PRoot to get it working with multiusers for travis and test it on several distros (Fedora and Ubuntu until now)
- Profile rmalias and trash-put, get better performance and uncomment long-standing tests
- Make it a FSM
##rmalias
- Finish -I