mistakenly created a directory -p how do I delete it

unix aix 6.1

I created a directory called

-p

how do I remove it?
LVL 1
bkreynolds48Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DavidSenior Oracle Database AdministratorCommented:
> rmdir '-p'
0
bkreynolds48Author Commented:
I get execute permission denied
usage rmdir [-p] DirectoryName
0
carlmdCommented:
To use that command you must have write permission to the parent directory, which I suspect you do not.

Try:

rm -r '-p'
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

DavidSenior Oracle Database AdministratorCommented:
Confirm that the '-p' directory is empty.

Horse of a different color, that is....   I trust you haven't changed your default location -- if you run 'ls -la' what is the permission string on the directory; and the one for the parent directory 'ls -la ..'

Is the account you're using the same that owns the parent directory?  If not, do they share a group (i.e., oradba)?

I'm looking into whether or not the command itself can be restricted with an ACL.
0
bkreynolds48Author Commented:
I own the directory that the -p directory was created in

the rm -r '-p' returns rm: Not a recognized flag :p

there is nothing in the -p directory

I changed the permission on the -p directory and that worked
weird

but cannot remove the dir
0
DavidSenior Oracle Database AdministratorCommented:
Wild idea, but try it using the grave accent ` (left of the "1" key) instead of the single quote '.
0
carlmdCommented:
My guess is that the name is not really "-p" but some other character in front or behind.

Try     ls *-p*

If that only returns the one item then...

rm -r *-p*
0
Gerwin Jansen, EE MVETopic Advisor Commented:
Try:

rmdir -- "-p"
0
Gerwin Jansen, EE MVETopic Advisor Commented:
Or:

rm -rf -- "-p"
0
bkreynolds48Author Commented:
I tried all of those an none of them worked
0
Gerwin Jansen, EE MVETopic Advisor Commented:
And what about:

rm -rf -- "*\-p*"

do an "ls -al" and show us the output please.
0
bkreynolds48Author Commented:
drwxrwxrwx    2 oracle   oracle           256 Oct 04 12:01 -p
drwxr-xr-x      4 oracle   oinstall          256  Oct 04 12:12 .
drwxr-xr-x   43 root       system         4096 Oct 03 13:57 ..
drwxr-xr-x    5 oracle     oinstall           256 Oct 04 12:13 app


ls did not find this
 "*\-p*"
0
carlmdCommented:
One more....

do ls -l | od -c

please post the result
0
bkreynolds48Author Commented:
oracle:/u01[]$ do ls -l |od -c
ksh: 0403-057 Syntax error: `do' is not expected.
0
carlmdCommented:
Sorry no "do" just type

ls -l | od -c
0
bkreynolds48Author Commented:
oracle:/u01[]$ ls -l |od -c
0000000    t   o   t   a   l       0  \n   d   r   w   x   r   w   x   r
0000020    w   x                   2       o   r   a   c   l   e        
0000040        o   r   a   c   l   e                                    
0000060        2   5   6       O   c   t       0   4       1   2   :   0
0000100    1       -   p  \n   d   r   w   x   r   -   x   r   -   x    
0000120                5       o   r   a   c   l   e               o   i
0000140    n   s   t   a   l   l                                   2   5
0000160    6       O   c   t       0   4       1   2   :   1   3       a
0000200    p   p  \n
0000203
0
carlmdCommented:
This clearly shows the name is just -p with no other characters.

The only other reason I can think of that you cannot delete this file is that something has it open.

Type the following:

fuser *

and post the result of the 4  directories
0
Gerwin Jansen, EE MVETopic Advisor Commented:
What does this show:

ls -l *p
0
bkreynolds48Author Commented:
fuser * returns usage for fuser
0
point_pleasantCommented:
try

rm ./-p

or


rm -- \-p
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bkreynolds48Author Commented:
rmdir ./-p worked

thanks:)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.