at same directory, is it cannot have same name text file and folder name?
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
at same directory, is it cannot have same name text file and folder name?
Hi, i have confuse with this: i am in folder /test inside there i have make a directory #mkdir folder1 , than inside /test have a directory name "folder1", now i want to create a text file in same location /test #vim folder1 ,but cannot create this text file? is it folder name and text file or what file also cannot have a same name?
i am in /mnt/hda , now nothing is mount to this directory, i have create a file in this directory, but now i just mount the harddisk partition to this directory mount -t ext3 /dev/hdd1 /mnt/hda than the directory /mnt/hda files which i create before i mount the /dev/hdd1 cannot view after i mount /dev/hdd1?
at same directory, is it cannot have same name text file and folder name?
That's right.
Code:
# mkdir folder
# vim folder
~
"folder" is a directory
# touch foo
# mkdir foo
mkdir: cannot create directory `foo': File exists
When you think about it, this behavior is quite reasonable. A directory is a file too... how can you have two files with the same name? How will the computer tell them apart?
Note - you should not be creating user-access directories off root like /text. Create them in your home directory (~/text) or off /usr/share ... the directories are organized that way for a reason. ~/documents is equivalent to My Documents... see?
You may have a folder and a file in the folder with the same name.
I agree, but that's not what he's asking and it is not what I said.
Quote:
i am in folder /test [1] inside there i have make a directory [2] #mkdir folder1 , than inside /test have a directory name [3] "folder1", now i want to create a text file [4] in same location /test #vim folder1 ,but [5] cannot create this text file?
... see?
# pwd ...[1]
/test
# mkdir folder1 ...[2]
# ls ...[3]
folder1
# vim folder1 ...[4]
~
"folder1" is a directory ...[5]
Last edited by Simon Bridge; 11-10-2007 at 09:14 AM.
i am in /mnt/hda , now nothing is mount to this directory, i have create a file in this directory, but now i just mount the harddisk partition to this directory mount -t ext3 /dev/hdd1 /mnt/hda than the directory /mnt/hda files which i create before i mount the /dev/hdd1 cannot view after i mount /dev/hdd1?
# pwd
/mnt/hda
# touch dummy
# ls
dummy
# mount -t ext3 /dev/hdd1 /mnt/hda
# ls
documents music archive (or whatever is in there, but not dummy)
# umount /mnt/hda
# ls
dummy
This too is the correct behavior. It hasn't overwritten "dummy", all it means is that /mnt/hda is now about a different drive.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.