undo rm -rf *
walker at omnisterra.com
Thu Mar 28 06:58:10 UTC 2013
> > I'm not a fan of trash directories. They give you a second chance, but
> > you may end up not really deleting things you wanted to delete. What
> > about a simple script something like this?
If you want something a bit more polished, you might check out
"nrm", available at http://www.omnisterra.com/walker/linux/nrm.html
It's a C program written to have the same arguments, return codes and
side effects as /bin/rm to the extent possible.
It moves files into the hidden sub-directory ".gone" instead of removing
files. You can remove files with "-s" and you get sequenced backups -
all files are saved with a time-stamp suffix for fine grained file
restores. There is a program "urm" to unremove the file, but most users
just do "ls .gone" to see what they've recently removed and then just
"mv" it back to their working directory.
There is an associated cron job that runs every day to permanently
remove all deleted files that are older than a configurable age.
The default is 3 days so you can get things back on Monday that you nuked
It's been running on HP-UX since about 1987, and on linux since 1997.
I'd consider it pretty solid at this point.
More information about the users