Find the answer to your Linux question:
Results 1 to 5 of 5
Hi Troops, Somehow I managed to create a file in /some/dir/ called "-v" How can I remove it? I've tried various and many methods... rm, rm *v, moving all files ...
  1. #1
    Just Joined!
    Join Date
    Mar 2009
    Posts
    2

    Deleting a nippy file

    Hi Troops,

    Somehow I managed to create a file in /some/dir/ called "-v"

    How can I remove it?

    I've tried various and many methods... rm, rm *v, moving all files except that one and then issuing rm -rf but the problem is the -v file is being taken for a switch huh.

    Any suggestions, this is driving me nutzola

    Regards

    Tam

  2. #2
    Linux Newbie
    Join Date
    Mar 2009
    Posts
    228
    Try specifying the full pathname.

    Code:
    rm -fv /some/dir/-v

  3. #3
    Linux Newbie Ziplock's Avatar
    Join Date
    Jan 2009
    Location
    Adelaide
    Posts
    169
    Hi there,

    This page has the answer:

    UNIX man pages : rm ()

    In particular:

    Code:
     To  remove a file whose name starts with a `-', for example `-foo', use one of these commands:
    
    rm -- -foo
    
    rm ./-foo

  4. #4
    Just Joined!
    Join Date
    Mar 2009
    Posts
    2

    Thanks chaps

    Cheers guys.

    I used lomcevak solution simply as it was the one I saw first and was email alerted to but thanks to ziplock too, I'll remember both methods.

    Kindest thanks

    Tam

  5. #5
    Linux Newbie Ziplock's Avatar
    Join Date
    Jan 2009
    Location
    Adelaide
    Posts
    169
    Glad to help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...