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

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/plain)
Delete this message
Reply to this message
Author: Dale Farnsworth
Date:  
To: plug-discuss
CC: 
Old-Topics: Re: How to command line rotate an image?
Subject: Removing a file whose name starts with '-', was Re: How to command line rotate an image?
> 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