Sample Header Ad - 728x90

Why "Not a directory" instead of "No such file or directory"?

6 votes
1 answer
2135 views
Consider this scenario:
$ file a b c
a: empty
b: cannot open `b' (No such file or directory)
c: cannot open `c' (No such file or directory)

$ file b/c
b/c: cannot open `b/c' (No such file or directory)

$ file a/b
a/b: cannot open `a/b' (Not a directory)
Why Not a directory instead of No such file or directory? Reason for the question: the ` a/b' (Not a directory)` may suggest that a/b needs to be a directory. However, a/b` may be a file. --- UPD. It seems that a/b may _not_ be a file because a is a file. Hence, the question: why `cannot open a/b' (Not a directory)` instead of cannot open a' (Not a directory)``?
Asked by pmor (665 rep)
May 12, 2025, 01:46 PM
Last activity: May 12, 2025, 02:18 PM