[H-GEN] Help! Is there any advice on recovering deleted files?

ben.carlyle at invensys.com ben.carlyle at invensys.com
Mon Aug 18 23:54:51 EDT 2003


Hello,





Greg Black <gjb at gbch.net>
Sent by: Majordomo <majordom at caliburn.humbug.org.au>
19/08/2003 11:51 AM
Please respond to general

 
        To:     general at lists.humbug.org.au
        cc: 
        Subject:        Re: [H-GEN] Help! Is there any advice on recovering deleted files?


> On 2003-08-18, Robert Brockway wrote:
> > Another good idea is to take advantage of the fact that expansion is 
done
> > in the shell in unix (unlike in MS-Windows).  As a result you can use 
ls
> > to list the files that you think you want to delete with rm.  The list
> > generated will be the same with both commands.  This is particularly
> > useful when you want to pass a complicated expansion to rm.

> Unless you want to use rm(1)'s "-r" option.  Consider:
>     $ cd /tmp/example
>     $ mkdir -p a/b/c/d
>     $ ls *
>     b
>     $ rm *
>     rm: a: is a directory

This is why I prefer echo to ls for rm safety:

$ rm * (uh oh I'm about to do an rm) ^H^H^H^H (start over...)
$ echo rm *
a
(yep, that's what I want to delete, browse back through command history, 
and remove "echo" from the beginning of the line)
$ rm *

> The real truth is that there are invocations of rm(1) that will
> have results that cannot be predicted by simple use of other
> standard tools, although find(1) can be used to assist with the
> impact of rm(1)'s "-r" option.

If you're doing a -r option then probably the best "tester" substitute is 
find.

$ rm -r * (uh oh...) ^H^H^H^H
$ find * -print
a
a/b
a/b/c
a/b/c/d
(yep, that's fine. Browse through history, replace find with rm -r, and 
delete -print)

> I once added a "-n" option to rm(1) that worked the same way as
> the similarly named option in make(1); some of my customers said
> it was helpful. 

Cute.
:)

Benjamin.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.humbug.org.au/pipermail/general/attachments/20030819/53572e7f/attachment.html>


More information about the General mailing list