Is the file extension of its trailing suffix (in linux terminology)?
In particular, what is the file extension and trailing suffix in the name .foo .


Observations

Basename (linux) command:
basename -s .foo .foo
displays .foo (assumes that in this case there is no trailing suffix).

In C ++, the following string:
std::cout << std::experimental::filesystem::path(".foo").extension() << '\n'
prints .foo (believes that the extension is).

In C #, this is:
Path.GetFileNameWithoutExtension(".foo")
gives an empty string (assumes that the extension is).

Also, as pointed out by Andrey NOP, in the chat, Explorer (Windows) displays the ".mp3" file with the mp3-file icon.

  • 2
    No, it's not. The file extension is under WIN. In normal OS there is a trailing suffix - any characters that are valid in the file name, starting with the second character of the file name. basename -s foo .foo will print . (point). - 0xdb
  • Your examples are not equivalent. basename knows about the special treatment of files starting with a dot. And in fact, in normal OS there is no such thing - the file type is determined through the mime type. - 0andriy

1 answer 1

technically, the extension of the file name (namely, the name, and not the file itself) existed in the antediluvian versions of the fat file system (and in several more fs ). No, it, of course, has not gone anywhere, but with the advent of vfat it has become irrelevant.

under the file name , 11 bytes were allocated to the fat , the first eight of which were treated as “name”, and the last three - as “extension” ( initially there were 6 + 3 in general ).

these two groups of bytes were usually separated when mapped to the user by a dot, which could not enter the file name.

since then, this restriction has been removed (and for the vast majority of file systems never existed at all).

that is, “the extension of the file name” is now rather a concept divorced from reality, without an unequivocal technical meaning. therefore, whoever wants it, he interprets it this way (this is, in fact, the answer to the question asked).


a little more accurately reflecting the current picture is the term "file name suffix".