linux-admin.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to delete a special directory
@ 2007-02-09 14:29 Mário Gamito
  2007-02-09 14:33 ` Scott Pack
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Mário Gamito @ 2007-02-09 14:29 UTC (permalink / raw)
  To: linux-admin

Hi,

I've accidently created two directories: -f and -q

Now, i can't remove them with rm -rf -f -q
I get an error.

Any ideas ?

Warm Regards,
Mário Gamito
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to delete a special directory
  2007-02-09 14:29 How to delete a special directory Mário Gamito
@ 2007-02-09 14:33 ` Scott Pack
  2007-02-09 15:01   ` Karey Weston
  2007-02-09 14:35 ` Florian Klien
       [not found] ` <200702090934.43065.doug@hunley.homeip.net>
  2 siblings, 1 reply; 8+ messages in thread
From: Scott Pack @ 2007-02-09 14:33 UTC (permalink / raw)
  To: linux-admin

[-- Attachment #1: Type: text/plain, Size: 351 bytes --]

M?rio Gamito [gamito@gmail.com] wrote:
> I've accidently created two directories: -f and -q
> 
> Now, i can't remove them with rm -rf -f -q
> I get an error.
> 

Try giving the full path name to the directory.  Such as,
rm -rdf ./-f ./-q




S.
-- 


--------------------------------------------------
Scott Pack
spack@cs.ohio.edu

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to delete a special directory
  2007-02-09 14:29 How to delete a special directory Mário Gamito
  2007-02-09 14:33 ` Scott Pack
@ 2007-02-09 14:35 ` Florian Klien
       [not found] ` <200702090934.43065.doug@hunley.homeip.net>
  2 siblings, 0 replies; 8+ messages in thread
From: Florian Klien @ 2007-02-09 14:35 UTC (permalink / raw)
  To: Mário Gamito, linux-admin

On 09.02.2007, at 15:29, Mário Gamito wrote:
> I've accidently created two directories: -f and -q
>
> Now, i can't remove them with rm -rf -f -q
> I get an error.
>
> Any ideas ?

try: rm -rf -- -f -q

that should do it. with the double dash you end the commands for rm.

hth
florian
-- 
Florian Klien
student of Telematics, tutor for 'Introduction to Structured
Programming' and 'Software Development Practical Exercises'
at Graz university of technology.
"We have persistent objects, they're called files.",
  Ken Thompson


-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to delete a special directory
  2007-02-09 14:33 ` Scott Pack
@ 2007-02-09 15:01   ` Karey Weston
  2007-02-09 16:59     ` Glynn Clements
  0 siblings, 1 reply; 8+ messages in thread
From: Karey Weston @ 2007-02-09 15:01 UTC (permalink / raw)
  To: Scott Pack, linux-admin

[-- Attachment #1: Type: text/plain, Size: 505 bytes --]

Try this (works with bash on BSD...Linux should be the same)

 rm -rf \-f \-q

Make sure you are in bash...the backslashes escape the - and take it as a
literal.

Cheers
wes


On 2/9/07 7:33 AM, "Scott Pack" <spack@cs.ohiou.edu> wrote:

> M?rio Gamito [gamito@gmail.com] wrote:
>> I've accidently created two directories: -f and -q
>> 
>> Now, i can't remove them with rm -rf -f -q
>> I get an error.
>> 
> 
> Try giving the full path name to the directory.  Such as,
> rm -rdf ./-f ./-q
> 
> 
> 
> 
> S.

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2147 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to delete a special directory
  2007-02-09 15:01   ` Karey Weston
@ 2007-02-09 16:59     ` Glynn Clements
  2007-02-09 17:15       ` Darío Mariani
  0 siblings, 1 reply; 8+ messages in thread
From: Glynn Clements @ 2007-02-09 16:59 UTC (permalink / raw)
  To: linux-admin


Karey Weston wrote:

> >> I've accidently created two directories: -f and -q
> >> 
> >> Now, i can't remove them with rm -rf -f -q
> >> I get an error.
> >> 
> > 
> > Try giving the full path name to the directory.  Such as,
> > rm -rdf ./-f ./-q
> 
> Try this (works with bash on BSD...Linux should be the same)
> 
>  rm -rf \-f \-q
> 
> Make sure you are in bash...the backslashes escape the - and take it as a
> literal.

That won't work. The dashes are significant to "rm", not the shell. 
The backslashes will be removed by the shell, and won't affect the
arguments which "rm" sees.

I have no idea why this would work on BSD; bash is bash, regardless of
the underlying OS.

-- 
Glynn Clements <glynn@gclements.plus.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to delete a special directory
  2007-02-09 16:59     ` Glynn Clements
@ 2007-02-09 17:15       ` Darío Mariani
  2007-02-09 18:07         ` Glynn Clements
  0 siblings, 1 reply; 8+ messages in thread
From: Darío Mariani @ 2007-02-09 17:15 UTC (permalink / raw)
  To: linux-admin

What about rm -rf "-r" "-f"?
If not, a file manager like Midnight Commander should do the trick.

On 2/9/07, Glynn Clements <glynn@gclements.plus.com> wrote:
>
> Karey Weston wrote:
>
> > >> I've accidently created two directories: -f and -q
> > >>
> > >> Now, i can't remove them with rm -rf -f -q
> > >> I get an error.
> > >>
> > >
> > > Try giving the full path name to the directory.  Such as,
> > > rm -rdf ./-f ./-q
> >
> > Try this (works with bash on BSD...Linux should be the same)
> >
> >  rm -rf \-f \-q
> >
> > Make sure you are in bash...the backslashes escape the - and take it as a
> > literal.
>
> That won't work. The dashes are significant to "rm", not the shell.
> The backslashes will be removed by the shell, and won't affect the
> arguments which "rm" sees.
>
> I have no idea why this would work on BSD; bash is bash, regardless of
> the underlying OS.
>
> --
> Glynn Clements <glynn@gclements.plus.com>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to delete a special directory
       [not found] ` <200702090934.43065.doug@hunley.homeip.net>
@ 2007-02-09 17:22   ` Mário Gamito
  0 siblings, 0 replies; 8+ messages in thread
From: Mário Gamito @ 2007-02-09 17:22 UTC (permalink / raw)
  To: linux-admin

Hi,

Thank you all for your answers.
Yhis did the trick :)

> /bin/rm -r -- ./-f ./-q

Warm regards,
Mário Gamito

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to delete a special directory
  2007-02-09 17:15       ` Darío Mariani
@ 2007-02-09 18:07         ` Glynn Clements
  0 siblings, 0 replies; 8+ messages in thread
From: Glynn Clements @ 2007-02-09 18:07 UTC (permalink / raw)
  To: Darío Mariani; +Cc: linux-admin


Darío Mariani wrote:

> > > >> I've accidently created two directories: -f and -q
> > > >>
> > > >> Now, i can't remove them with rm -rf -f -q
> > > >> I get an error.
> > > >>
> > > >
> > > > Try giving the full path name to the directory.  Such as,
> > > > rm -rdf ./-f ./-q
> > >
> > > Try this (works with bash on BSD...Linux should be the same)
> > >
> > >  rm -rf \-f \-q
> > >
> > > Make sure you are in bash...the backslashes escape the - and take it as a
> > > literal.
> >
> > That won't work. The dashes are significant to "rm", not the shell.
> > The backslashes will be removed by the shell, and won't affect the
> > arguments which "rm" sees.
> >
> > I have no idea why this would work on BSD; bash is bash, regardless of
> > the underlying OS.
> 
> What about rm -rf "-r" "-f"?

The same issue applies; the shell will simply "eat" the quotes before
passing the strings to "rm", which will interpret them as switches
rather than filenames.

Quotes and backslashes are shell syntax. They will help if the problem
is because the filename means something to the shell (e.g. a file
named "~" or "<" or "$foo"), but not if the filename means something
to the program (e.g. a file named "-f").

For that situation, you need to use "--" (which should work with any
program which uses getopt()), or the "./-f" trick.

-- 
Glynn Clements <glynn@gclements.plus.com>
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-02-09 18:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-09 14:29 How to delete a special directory Mário Gamito
2007-02-09 14:33 ` Scott Pack
2007-02-09 15:01   ` Karey Weston
2007-02-09 16:59     ` Glynn Clements
2007-02-09 17:15       ` Darío Mariani
2007-02-09 18:07         ` Glynn Clements
2007-02-09 14:35 ` Florian Klien
     [not found] ` <200702090934.43065.doug@hunley.homeip.net>
2007-02-09 17:22   ` Mário Gamito

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).