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

Shannon Carver shannon.carver at p-s-t.com.au
Tue Oct 25 14:11:33 WST 2005


Thanks for that guys, works a treat.

I don't usually deal with filenames with hyphens at all, however an unnamed
bit-torrent site I use name half their .torrent files prefixed with a '-'.

Cheers

-----Original Message-----
From: plug-bounces at plug.org.au [mailto:plug-bounces at plug.org.au] On Behalf
Of Tomasz Grzegurzko
Sent: Tuesday, 25 October 2005 11:44 AM
To: plug at plug.org.au; draoidh at iinet.net.au
Subject: Re: [plug] Deleting/Moving files beginning with '-'

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
> 



_______________________________________________
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