1756426 Members
3104 Online
108847 Solutions
New Discussion юеВ

Re: removing files

 
SOLVED
Go to solution
Chern Jian Leaw
Regular Advisor

removing files

HI,

I have a file which has the following filename:
--same-owner.

When I tried removing it with :
#rm -rf --same-owner

It complains of the following:
#rm -rf --same-owner
rm:Not a recognized flag:-

How do I remove such files?

Thanks
7 REPLIES 7
John Palmer
Honored Contributor
Solution

Re: removing files

Hi,

rm thinks that the leading -- are flags. You can get around it as follows:-

rm -- --same-owner

Regards,
John
Peter Godron
Honored Contributor

Re: removing files

The command ./--same-owner should also work
Deinert Arthur
New Member

Re: removing files

I only have a workaround:
If I have a file name such as "--same-owner", I create a file "+same-owner" (because "+" comes in ASCII order before "-"), then I can use:
rm -i *same-owner*
Then I can commit to remove "+same-owner" and "--same-owner".
Peter Godron
Honored Contributor

Re: removing files

Hi,
if this problem is solved, please close the thread.
Regards
Fred Ruffet
Honored Contributor

Re: removing files

Peter,

What is your goal ? Do you want to request closing all thread that are 3 years old ?

Fred
--

"Reality is just a point of view." (P. K. D.)
Peter Godron
Honored Contributor

Re: removing files

Fred,
just going through my old responses.
Though it would be nice of the original poster to close the resolved threads.
Sorry,
Peter
Fred Ruffet
Honored Contributor

Re: removing files

Peter,

Have a look at Cheryl's "forum issues" post and have a look at the closing thread problem.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)