Operating System - HP-UX
1829595 Members
2141 Online
109992 Solutions
New Discussion

removing files with odd names

 
SOLVED
Go to solution
Kurt Greener
Occasional Contributor

removing files with odd names

I have files with the names of -laa. I have tried rm "-laa". System returns errors saying -l illegal option. How can I remove them?
8 REPLIES 8
Sanjay_6
Honored Contributor

Re: removing files with odd names

Hi Kurt,

Try this,

cd /dir
ls >test
vi test

Remove all entries other than the ones you want to remove. Add rm before all the entries that you want to remove. Save and exit.

Then run,

sh test

Hope this helps.

Regds
Luc Bussieres_1
Trusted Contributor
Solution

Re: removing files with odd names

Kurt,

To remove that file you could type the following command:

rm -- -laa

The -- tell rm that it's the end of the parameters so it will accept your filename after.

Regards
Luc

Uday_S_Ankolekar
Honored Contributor

Re: removing files with odd names

Hi
Did you try rm -- -ls

-USA..

Good Luck..
Peter Kloetgen
Esteemed Contributor

Re: removing files with odd names

Hi Kurt,


very easy:

rm ./-laa

or from a different working directory:

rm /path_to_file/-laa

Allways stay on the bright side of life!

Peter
I'm learning here as well as helping
Uday_S_Ankolekar
Honored Contributor

Re: removing files with odd names

I mean.... rm -- -laa

-USA..
Good Luck..
Steve Steel
Honored Contributor

Re: removing files with odd names

Hi

ll *-*

If you see what you want to remove

rm *-*

Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Martin Johnson
Honored Contributor

Re: removing files with odd names

Always use rm -i to make sure you don't remove the wrong file(s)!


Marty
Jeanine Kone
Trusted Contributor

Re: removing files with odd names

I'll add the non-technical way to do it: if you have the GUI interface, just use the file manager tool, navigate to the appropriate directory, highlight the file, and then delete.