<p>I know that it does in PHP, and I'm pretty sure it does in Java. I haven't used the latest versions of .NET, so I won't speak for them. It seems very awkward, but I was wondering if there was an underlying reason for this.</p>

[{'answer_id': 50152, 'author': 'ColinYounger', 'author_id': 1223, 'author_profile': 'https://Stackoverflow.com/users/1223', 'pm_score': 3, 'selected': True, 'text': "<p>One reason is compatibility - anyone who has done 'check for existence' knows to exclude directories; changing that behaviour may confuse those who rely on that behaviour.</p>\n\n<p>Secondly, the underlying code often does a check on the operating system for existence in a catlog of filesystem entries - to the OS, a directory is the same as a file. In other words, it's looking for an entry of 'xyz' in the catalog not a file with name 'xyz' in the catalog.</p>\n\n<p>Backwards compatability is the main reason, I suspect.</p>\n"}, {'answer_id': 50173, 'author': 'georgebrock', 'author_id': 5168, 'author_profile': 'https://Stackoverflow.com/users/5168', 'pm_score': 1, 'selected': False, 'text': '<p>It is common to use a “file exists” function to check a path before writing to it. In this use case the type of file is irrelevant, if there is a directory called “/home/foo” you won\'t be able to create a file called “/home/foo”</p>\n\n<p>Also PHP, one of the languages you mentioned, provides several functions depending on what kind(s) of file you care about:</p>\n\n<ul>\n<li><a href="http://uk3.php.net/manual/en/function.file-exists.php" rel="nofollow noreferrer"><code>file_exists()</code></a> will return TRUE for files, directories and symbolic links</li>\n<li><a href="http://uk3.php.net/manual/en/function.is-file.php" rel="nofollow noreferrer"><code>is_file()</code></a> will return TRUE for files, but FALSE for directories and sym links</li>\n<li><a href="http://uk3.php.net/manual/en/function.is-dir.php" rel="nofollow noreferrer"><code>is_dir()</code></a> will return TRUE for directories, but FALSE for files and sym links</li>\n<li><a href="http://uk3.php.net/manual/en/function.is-link.php" rel="nofollow noreferrer"><code>is_link()</code></a> will return TRUE for symbolic links, but FALSE for files and directories</li>\n</ul>\n'}, {'answer_id': 50178, 'author': 'knuton', 'author_id': 4991, 'author_profile': 'https://Stackoverflow.com/users/4991', 'pm_score': 2, 'selected': False, 'text': '<p>There is also a formal reason why a directory is a file:</p>\n\n<blockquote>\n  <p>Files (or links to files) can be\n  located in directories. However, more\n  generally, a directory can contain\n  either a list of files or a list of\n  links to files. Within this\n  definition, it is of paramount\n  importance that the term "file"\n  includes directories. This permits the\n  existence of directory hierarchies,\n  i.e., directories containing\n  subdirectories.</p>\n</blockquote>\n\n<p>From Wikipedia, <a href="http://en.wikipedia.org/wiki/Computer_file#Identifying_and_organizing_files" rel="nofollow noreferrer">‘Computer file’</a></p>\n'}, {'answer_id': 9387666, 'author': 'Matthew Flaschen', 'author_id': 47773, 'author_profile': 'https://Stackoverflow.com/users/47773', 'pm_score': 0, 'selected': False, 'text': '<p>Part of the Unix philosophy is that "<a href="http://www.cs.bgu.ac.il/~arik/usail/concepts/filesystems/everything-is-a-file.html" rel="nofollow">everything is a file</a>".  This has influenced other environments as well to some degree.</p>\n'}]
['https://Stackoverflow.com/questions/50148', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/572/']