[plug] Deleting/Moving files beginning with '-'

Tomasz Grzegurzko tomasz_g at arach.net.au
Tue Oct 25 11:44:23 WST 2005


I did something like that once

rm "./--aasldkfjsldf" will do the trick.

Tomasz

Quoting Padraig MacIain <draoidh at iinet.net.au>:

> On Tue, Oct 25, 2005 at 10:31:59AM +0800, Shannon Carver wrote:
> > Hi Guys, 
> > 
> > In light of the find -exec query, I thought I'd ask my question on how to
> > delete files from a shell that start with a hyphen/dash.  My solution thus
> > far, has just been to use Nautilus/Konqueror as its handled them fine, but
> I
> > know there must be a way to handle them, but I just can't find the right
> > command to do it.
> > 
> > The problem with the hyphen of course, is it takes the next letter or
> > letters after the hyphen as options like cp -a etc etc.
> > 
> > I've tried all the things I can think of, escaping the hyphen, putting it
> in
> > quotes, this hasn't worked.
> > 
> > Whats the solution?
> > 
> 
> 
> i think it is something like :
> 
> 	cp -a -- -filewithhyphen
> 
> the -- tells the cp command to treat all following leading hyphens as part
> of the filename as opposed to switches.
> 
> P.
> _______________________________________________
> PLUG discussion list: plug at plug.org.au
> http://www.plug.org.au/mailman/listinfo/plug
> Committee e-mail: committee at plug.linux.org.au
> 






More information about the plug mailing list