Operating System - HP-UX
1752809 Members
5964 Online
108789 Solutions
New Discussion

Can a file and a directory share a same path in UX?

 
Henry Chua
Super Advisor

Can a file and a directory share a same path in UX?

Hi..
Recently I discovered that a file and a directory shares the same path.. is this possible? what is the possible cause and implication?

thank you for your advise!

 

P.S. This thread has been moved from HP-UX Technical Documentation to HP-UX > sysadmin. -HP Forum Moderator

3 REPLIES 3
Manish Srivastava
Trusted Contributor

Re: Can a file and a directory share a same path in UX?

Hi,

I think this is not possible. It can only be possible if it is a link. You can try this to check the theory:

mkdir 1
ln -s 1 1

this works but if you do ls 1
you see only the link not the directory but if you do cd 1 you can cd into the dir as 1 is a link to it.

regards,
manish
Cheryl Griffin
Honored Contributor

Re: Can a file and a directory share a same path in UX?

Can you show us a full listing of the file, directory? The inode would determine if the path of the directory and file are indeed exactly the same.
# ls -lai
"Downtime is a Crime."
Scot Bean
Honored Contributor

Re: Can a file and a directory share a same path in UX?

There are hard links and soft links. The above example is a soft link.

Directories exist as files.