LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-24-2005, 12:14 AM   #1
chack
LQ Newbie
 
Registered: Jan 2005
Location: India
Distribution: Redhat
Posts: 4

Rep: Reputation: 0
Creation of file and directory with same name


Hi

Why cant a file and a directory with the same name be created in the same directory. I found that in linux filesystems, all the files have different inode numbers, and that directory is treated as a file(which has enties pointing to files inside it). If this is the case then why is it impossible to create a file and directory with the same name in a directory.

Also are there any file system in any OS in which this is possible?

Chack
 
Old 01-24-2005, 12:16 AM   #2
Alligator
LQ Newbie
 
Registered: Jan 2005
Location: San Diego,CA
Distribution: FC3,ASPL 7.2,mandrake 92
Posts: 16

Rep: Reputation: 0
because os don't wont confuse you with ex:25files with the same name! I don't thinkso!
 
Old 01-24-2005, 12:28 AM   #3
dylbyrt45
Member
 
Registered: Sep 2003
Location: Dallas
Distribution: Suse 9.1 pro
Posts: 37

Rep: Reputation: 15
Not sure why you would want to, but,,, remember Linux is case sensitive. If the directory starts with a cap example: /home/Jazz you can have a file in that directory named jazz. Have one in caps, and one that isn't
 
Old 01-24-2005, 12:37 AM   #4
chack
LQ Newbie
 
Registered: Jan 2005
Location: India
Distribution: Redhat
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks for the replies.

What i was thinking was like if the inode numbers are unique and if the directory inodes are having a list of inode pointers, then a cd command can recognize a directory and get in , even if a file with the same name exists in the directory.

Avoiding confusion to the users maybe the reason, is there any other reason?

I had this question come up in a seminar on inodes and that why i am asking...

:-) Chack
 
Old 01-24-2005, 09:43 PM   #5
dylbyrt45
Member
 
Registered: Sep 2003
Location: Dallas
Distribution: Suse 9.1 pro
Posts: 37

Rep: Reputation: 15
Well now that I have played for a minute or two, I guess you can have a file in a directory with the same name as a directory. You can also have a directory inside a directory with the same name.

Example: /home/george/george

Would not of known that if you hadn't asked. Hope this helps.
 
Old 01-24-2005, 10:20 PM   #6
chack
LQ Newbie
 
Registered: Jan 2005
Location: India
Distribution: Redhat
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Well now that I have played for a minute or two, I guess you can have a file in a directory with the same name as a directory. You can also have a directory inside a directory with the same name.

Example: /home/george/george

Would not of known that if you hadn't asked. Hope this helps.



I am not sure if I was clear enough in explaining the issue.


What I meant is to create a file and a directory with the same name inside another directory. For example

directory1
|
directory2
| |
test test
(directory) (file)

I want to know why it is not possible to create a file and a directory , both with the name "test" under the directory "directory2".

:-) Chack

Last edited by chack; 01-24-2005 at 11:50 PM.
 
Old 01-24-2005, 11:41 PM   #7
mjrich
Senior Member
 
Registered: Dec 2001
Location: New Zealand
Distribution: Debian
Posts: 1,046

Rep: Reputation: 45
Re: Creation of file and directory with same name

Quote:
Originally posted by chack
in linux filesystems, all the files have different inode numbers, and that directory is treated as a file
IMHO, this already answers your question...

Under linux, everything is treated as a file, thus the problem of having two files with the same name.

Cheers,

mj
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cache Swap Directory Creation Problem arun_ain Linux - Software 4 06-14-2005 05:45 AM
Automatic AD user directory creation/mapping HalJordan Fedora 5 02-19-2005 11:31 AM
Azureus directory creation cleff Linux - Software 4 08-21-2004 11:41 PM
makedev - accidental creation of a directory machala Mandriva 3 07-17-2004 04:36 AM
RPM Spec file creation: %file section question davidas Linux - Newbie 0 03-16-2004 11:36 PM


All times are GMT -5. The time now is 08:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration