[Gllug] Undelete...?

Daniel P. Berrange dan at berrange.com
Thu Feb 5 15:21:09 UTC 2004


On Thu, Feb 05, 2004 at 02:13:49PM -0000, Kristian Davies wrote:
> mdk 7
> 
> I had a directory with a couple of files starting with "?blah"
> So like a Burk I deleted them with "rm -fr ?*" ... Don't laugh!
> 
> Well anyway, in that directory was a script I use all the time, which I
> would rather no rewrite.
> 
> Is there a way of getting my file back?
> 
> I realise this is a total newb question, but I find it hard to believe there
> is no way of recovering a file which has not been overwritten.

There are various levels of protection you can use, by setting up
command aliases. For example, as root, always have

  alias rm="rm -i"
  alias mv="mv -i"
  alias cp="cp -i"

Of course, since you supplied '-f' that wouldn't help.

So for even greater protection alias 'rm' to instead do a copy with
backups:

function rm {
  if [ ! -d ~/.trash ]; then
    mkdir ~/.trash
  fi
  
  mv --backup=numbered $@ ~/.trash
}

So instead of deleteing the files, 'rm' now simply moves them
to the trash directory, renaming any files already there with
ever increasing numbered suffixing.

Or just use a GUI file manager like Nautilus instead of the shell.

For networked storage, the AFS filesystem can be configured to take
a daily file system snapshot &make that available, at ~/.yesterday

Dan.
-- 
|=-               http://www.berrange.com/~dan/gpgkey.txt             -=|
|=-   berrange at redhat.com  -  Daniel Berrange  -  dan at berrange.com    -=|
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20040205/c2557e57/attachment.pgp>
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list