LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-01-2005, 10:06 AM   #1
davesbedroom
LQ Newbie
 
Registered: Jan 2005
Posts: 27

Rep: Reputation: 15
rm -rf a file starting with -


I have two files I want to get rid of, but they are

-send.xml
-.xml

so when I try to

rm -rf -send.xml

I get

rm: invalid option -- s
Try `rm --help' for more information.

same problem with -.xml

I tried mv and I get

mv: invalid option -- .
Try `mv --help' for more information.

adding quotes doesn't help, I tried \-send.xml and that doesn't work.

How do you handle files that start with - ?
 
Old 06-01-2005, 10:10 AM   #2
heema
Senior Member
 
Registered: Sep 2003
Location: Egypt
Distribution: Arch
Posts: 1,528

Rep: Reputation: 47
just add -- before the file

e.g.:
Code:
rm -rf -- -send.xml

its in man rm

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

       rm -- -foo

       rm ./-foo

Last edited by heema; 06-01-2005 at 10:12 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Starting X :cannot open shared object file DraaX Slackware 18 02-16-2005 09:54 AM
Terminal cmd for starting Matlab M-file editor without starting matlab fubzot Linux - Software 2 02-15-2005 07:49 AM
Deleting a file starting with a ? bitpicker Linux - General 6 11-24-2004 02:20 PM
Starting httpd: execvp: No such file or directory jules_fraser Linux - Software 2 01-18-2004 09:43 AM
Starting httpd: execvp: No such file or directory jules_fraser Linux - Networking 6 01-18-2004 07:36 AM


All times are GMT -5. The time now is 01:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration