How to remove files '-c' '-z'

How to remove files '-c' '-z'

Post by George Daswa » Wed, 19 Oct 1994 01:49:59



Hello,

Can somebody help me out there..  Well here's my problem..  Out
of stupidity I made some files with the filename of

-c  

and the other

-z

(those are the name of the files)..

rm refuses to remove them.... I do

rm -c (It comes out with an invalid switch??)

if I do rm * (It comes out with -c invalid option)..

I tried almost everything, how do I delete this..

Thanks for any reply..

George Daswani

 
 
 

How to remove files '-c' '-z'

Post by Andreas Dunk » Thu, 20 Oct 1994 03:00:31



> Hello,
> Can somebody help me out there..  Well here's my problem..  Out
> of stupidity I made some files with the filename of
> -c  
> and the other
> -z
> (those are the name of the files)..
> rm refuses to remove them.... I do
> rm -c (It comes out with an invalid switch??)
> if I do rm * (It comes out with -c invalid option)..
> I tried almost everything, how do I delete this..
> Thanks for any reply..
> George Daswani

Look into the unix FAQ and you find:

-------------------------------------- snip ----------------------

Subject: How do I remove a file whose name begins with a "-" ?
Date: Thu Mar 18 17:16:55 EST 1993

2.1)  How do I remove a file whose name begins with a "-" ?

      Figure out some way to name the file so that it doesn't begin
      with a dash.  The simplest answer is to use

            rm ./-filename

      (assuming "-filename" is in the current directory, of course.)
      This method of avoiding the interpretation of the "-" works with
      other commands too.

      Many commands, particularly those that have been written to use
      the "getopt(3)" argument parsing routine, accept a "--" argument
      which means "this is the last option, anything after this is not
      an option", so your version of rm might handle "rm -- -filename".
      Some versions of rm that don't use getopt() treat a single "-"
      in the same way, so you can also try "rm - -filename".

-------------------------------------- snap ----------------------

Andreas

--
------------------------------------------------------------------------
Andreas Dunker                                                2B || ! 2B


 
 
 

How to remove files '-c' '-z'

Post by David Sava » Wed, 19 Oct 1994 03:36:47


Hello,

Try rm -- -c -z

The -- tells rm to treat anything after it as a filename (for just
such a problem as yours).

Dave

 
 
 

How to remove files '-c' '-z'

Post by Guess wh » Wed, 19 Oct 1994 07:30:16


: Hello,

: Can somebody help me out there..  Well here's my problem..  Out
: of stupidity I made some files with the filename of

: -c  

: and the other

: -z

: (those are the name of the files)..

: rm refuses to remove them.... I do

: rm -c (It comes out with an invalid switch??)

: if I do rm * (It comes out with -c invalid option)..

: I tried almost everything, how do I delete this..

rm -i *
It'll ask you for each and every file whether or not you want to delete
it.  Say yes only to "-c" and "-z".  Once you get past those, yuo can
safely ^C.

: Thanks for any reply..

: George Daswani

--
#------------------------------------------------------------------------#



#>----------------------------------------------------------------------<#
|               "Insanity is necessary for understanding."               |
#>----------------------------------------------------------------------<#

|       UL++++S+U+X(-) P? L++>+++ 3- E- N(-) K- W(---)>! M-- V-(--)      |
|       -po+ Y+ t+ !5 j R(+) G'''>'''' !tv() b+ D+ B-- e+(++)>+++        |

#------------------------------------------------------------------------#

 
 
 

How to remove files '-c' '-z'

Post by Pekka J Taipa » Wed, 19 Oct 1994 18:09:02



Quote:>rm -i *

Not a very good advice. If "rm" is aliased to something different, or
you mistype, you lose files. A preferable, simple way is to say

rm ./-c

And, this way you can also remove a file whose name is "-i".

--

 
 
 

How to remove files '-c' '-z'

Post by John Palai » Thu, 27 Oct 1994 05:07:57




>Hello,

>Try rm -- -c -z
>The -- tells rm to treat anything after it as a filename (for just
>such a problem as yours).

or, for a solution portable to non-gnu versions of rm (I was going to say
non-gnu rms but that sounded strange:) you could try:
rm ./-c ./-z
which makes the "-" no longer be the first name of the file, so rm
doesn't complain.  -- And this works, to, I just tried it.
--
Richard Cooley Extraordinaire           "Yeah.  Arrgh."


"LILO - it's not just a boot loader, it's a way of life" -- me
 
 
 

1. Need advice on removing 'old' entries listed by 'who -u'

Hello world!

Having searched the Info Explorer 'a couple of times' for a method of
of removing these nonexisting entries listed by 'who -u', I have come
to the conclusion that it is not there!

If you have some advice on the trick please give some feedback.

Btw. I'm using AIX 3.2.5 and onwards up to 4.2

Thanks,

Michael Reiche Jakobsen

 - http://www.cybernet.dk/users/reiche/reiche.htm

2. "noexec" ignored when mounting cdrom

3. about remove 'LF' but keep 'CR/LF'

4. What are the Apache status code definitions?

5. 'cat file' but only if 'file' exist

6. Setting up a Gateway

7. Coverting '.so' files to '.o' files

8. Free C++ class lib for lists/trees/strings/etc... where?

9. File size of 'tmp' files for 'vi'

10. "rm: can't unlink 'files'",can't delete files

11. What's wrong with 'file protocol' or 'http://localhost protocol'?

12. FTP'ed files default to '-rw-r--r--' i need '-rw-------'

13. 'test' or 'if' for an accessed file