- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- how to remove directories of name like "-a" & "-".
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2003 12:22 AM
07-30-2003 12:22 AM
mistakenly some body have created few directories with the name starting with the "-" (minus) sign & "-" itself.....for e.g. -a, -cad, - ......
when i try to remove "-a" dir using the following command:
#rm -rf -a
i am getting the following error message:
rm:illegal option -- a
Usage: rm [-Rfir] file ...
And I am afraid to try the same above command for removing "-" dir because "-" in unix stands for previous dir (i mean successful prev. cd).
Can anyone tell me how to remove the above said directories.....
Thanks in advance.....
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2003 12:24 AM
07-30-2003 12:24 AM
Re: how to remove directories of name like "-a" & "-".
rm -r "-a"
Massimo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2003 12:25 AM
07-30-2003 12:25 AM
Re: how to remove directories of name like "-a" & "-".
rm -- -a
Will do the trick ...
Regards,
Tom Geudens
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2003 12:26 AM
07-30-2003 12:26 AM
Re: how to remove directories of name like "-a" & "-".
$ rm -rf "-a"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2003 12:29 AM
07-30-2003 12:29 AM
Re: how to remove directories of name like "-a" & "-".
Try the following:
rmdir -- -a
rmdir -- -
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2003 12:29 AM
07-30-2003 12:29 AM
Re: how to remove directories of name like "-a" & "-".
Sorry about that ... should have been
rm -rf -- -a
or
rmdir -- -a
-- ends the commandline options
Regards again,
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2003 12:29 AM
07-30-2003 12:29 AM
Re: how to remove directories of name like "-a" & "-".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2003 12:31 AM
07-30-2003 12:31 AM
Re: how to remove directories of name like "-a" & "-".
# cd
# rm ./-a
will also work. If you want to create the file again in order to try another suggestion, then # touch -- -a
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2003 12:54 AM
07-30-2003 12:54 AM
Re: how to remove directories of name like "-a" & "-".
You ca also easily remove it from the parent directory:
cd ..
rmdir
or from your current directory:
rmdir ./-a
Bye!
Simone
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2003 12:59 AM
07-30-2003 12:59 AM
Re: how to remove directories of name like "-a" & "-".
#cd somedir
#rm -r "./-a"
-ux
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2003 01:04 AM
07-30-2003 01:04 AM
Re: how to remove directories of name like "-a" & "-".
This will also work.
find . -name "-*" -exec rm -r -f {} \;
This will remove all any file or directory starting with "-".
regds
baiju.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2003 01:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2003 03:30 AM
07-31-2003 03:30 AM
Re: how to remove directories of name like "-a" & "-".
first of all I thank all of you for showing interest......
My problem is solved and i used the following commands:
rm -rf -- -a
rm -rf -- -
or
rm -r "./-a"
rm -r "./-"
or
find . -inum
Where
directory by "ls -li".
Some person has given "rmdir" and if i am correct then this command will be useful or successful only when the directory is empty.
Few more have stated
rm -- -a
and
rm -rf "-a"
Inorder to remove a dir i think we have to use "-r" along with "rm" command in the first and the above second command will give error...
Thank you.......
karthik