Results 1 to 5 of 5
hi all,
how to remove a file, which is starting with hyphon "-" ? ex: -file1.txt. iwant to remove this file..
thank in advance....
- 09-16-2009 #1Just Joined!
- Join Date
- Sep 2009
- Posts
- 6
removing a file
hi all,
how to remove a file, which is starting with hyphon "-" ? ex: -file1.txt. iwant to remove this file..
thank in advance.
- 09-16-2009 #2Just Joined!
- Join Date
- Aug 2009
- Location
- Mumbai, India
- Posts
- 75
Hi,
Try this: rm -rf ./-file1.txt
--Syd
- 09-16-2009 #3Just Joined!
- Join Date
- Sep 2009
- Posts
- 6
thank u .. its working
- 09-16-2009 #4This assumes you are in the same directory as the file. You can use the full path and it will work as well. You don't really need the recursive and force flags (-rf)for a single file either. I'm wary of using those unless I absolutely need to, since a little mistype means a lot of lost data.rm -rf ./-file1.txt
- 09-17-2009 #5Linux Enthusiast
- Join Date
- Aug 2006
- Location
- Portsmouth, UK
- Posts
- 539
You can always use the -- switch:
Code:rm -- -file1.txt
RHCE #100-015-395
Please don't PM me with questions as no reply may offend, that's what the forums are for.


Reply With Quote