How do I remove the following file...

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Jeffrey Pyne
Date:  
Subject: How do I remove the following file...
Oh sure, suggest the easy, obvious method. :) That definitely works in
this case, but the reason I usually do it this way it that it handles things
like this:

# mkdir '.. '
# ls -a
. .. ..        <-- Careful with that axe, Eugene! 


or this:

# ls
-z
# rm '-z'
rm: invalid option -- z
Try `rm --help' for more information.
# rm *z
rm: invalid option -- z
Try `rm --help' for more information.

or this:

# ls
^M <-- a CTRL-M, not caret-M
# rm ^M
rm: cannot remove `^M': No such file or directory

or this:

# ls -l
-rw-r--r--    1 root    root        0  Aug 22 10:04
                                                       ^^^^^^^^^
                                                       What's the name of
this file? 
                                                       Is it ' ' or '  ' or
'   ' or...


There are multiple ways to handle each of these cases, but I like the find
method because it handles all of them with equal ease.

~Jeff

On Tuesday, August 21, 2001 Hsiu-Hsing L. Jerome wrote:

> > >
> > > Method #217 to skin this cat:
> > >
> > > # ls -i *q
> > > 363592 \033:\033\033::q
>
> ok, why not just
>     rm *q
> ?

>
> > >
> > > # find . -inum 363592 -exec rm -i {} \;
> >