Mkdir making multiple identical file names


#1

What happens if mkdir is used to make identical file names in the same directory? What will happen if one tries to access these files, since there are no errors thrown out when the files are initially made?


#2

The more obvious consequence is destruction of an existing file when we declare a new file of the same name.


#3

That’s all quite self-evident isn’t it?
If you make a name refer to something new, then it refers to something new, and no longer to the old.
The mkdir on my system refuses to overwrite though, and I suspect yours does too.

$ touch blah
$ mkdir blah
mkdir: cannot create directory ‘blah’: File exists

#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.