Andrew Sackville-West wrote:
On Tue, Jan 23, 2007 at 11:25:21AM -0900, Ken Irving wrote:

On Tue, Jan 23, 2007 at 11:32:31AM -0800, Andrew Sackville-West wrote:

On Tue, Jan 23, 2007 at 02:06:02PM -0500, Tony Heal wrote:

OK, how about some preventative stuff. If there is not real way to
'undelete' files. How about adding a script named 'rm' that passes the same
switches to from the script to /bin/rm but moves the files to tmp before
deleting them.

I don't have one, but it would be trivial to write a bash script that
takes an rm <arglist> <target> and turns it into a mv <target>
/tmp/trash. simply alias rm to that script in bashrc et al. or, if you
wanted system-wide "Trashing" you could mv the rm binary out of the
way and symlink to your script. the implications of that could be huge
though.

Something like this *might* work, but is off-the-cuff, not tested:


[snip]


sorta works but bombs if .trash doesn't exist, or if rm switches are
used (eg. -rf). hows this


[snip]


A real danger in using this sort of crutch is that you'll get nailed if
you rely on it, assume it's there, and then end up using the native rm
without knowing it.  The same goes for alias rm='rm -i'.

IMHO the best approach is to realize the nature of the system you're
working with, learn to use the native commands, and set up a decent
backup system.

Another approach is that mentioned in

http://www.mikerubel.org/computers/rsync_snapshots/

Look for "Extensions: hourly, daily, and weekly snapshots"

One can create a directory ~/.snapshot with subdirectories
like hourly.1, hourly.2, daily, monthly, etc.

If you delete a file, then a copy which is at most one hour
old will be in ~/.snapshot/hourly.1

The technique described does not eat enormous amounts of disc,
either.

Mike
--
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to