Re: Removing a file whose name starts with '-', was Re: How …

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ (text/plain)
Delete this message
Reply to this message
Author: Mike Ballon
Date:  
To: Main PLUG discussion list
Subject: Re: Removing a file whose name starts with '-', was Re: How to command line rotate an image?
OK, this is the last time I answer from the bar :)

I didn't mean that using inodes was the "only" way, I just knew it would
work.

I also stated that the syntax might not be correct as I didn't test it.

[name@hostd1 ~]$ ls -li
total 64
31758 -rw-rw-r-- 1 user group 4549 Oct 21 14:50 text.html
[name@hostd1 ~]$ find . -inum 31758 -exec rm -i {} \;
rm: remove regular file `./text.html'? y

You could also use find . -inum 31758 | xargs rm

I think CLI users should be aware of multiple options so thanks to those
that replied with how to escape the special characters.

-Mike

On Fri, Nov 12, 2010 at 9:42 AM, Dale Farnsworth <>wrote:

> > I don't know who to rotate the image, but to delete your file you need
> > to use the inode. This is off the top of my head so if the synax is
> > wrong you can just google it.
> >
> > ls -il "-rotate90"
> >
> > find . -inum 123456 -exec rm -i {} \;
>
> The above suggestion doesn't work because the ls command fails. It's
> also a very roundabout way to delete a file. There is no need to use
> i-numbers.
>
> The manual page for rm says:
>        To  remove a file whose name starts with a ‘-’, for example ‘-foo’,
>        use one of these commands:

>
>                rm -- -foo

>
>                rm ./-foo

>
> Using "--" to separate flags/options from filenames works for many
> commands, including ls.
>
> -Dale
>
> ---------------------------------------------------
> PLUG-discuss mailing list -
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss