LakshaySingh
LakshaySingh

Reputation: 39

What is the purpose of dot (.) in filename before extension. Is it some sort of operator?

filename.txt

string.h

Consider above filenames, is there any specific meaning of using dot (.) in any file name.

we use it everywhere, in every file.

Upvotes: 1

Views: 1639

Answers (2)

datenwolf
datenwolf

Reputation: 162164

Generally speaking there's nothing special about it.

However certain operating systems and file systems may assign special meaning to certain characters, but the characters themself are pretty much arbitrary choices.

Back in the old days of DOS, the FAT file system and 8.3 names the . actually was interpreted by the file system to jump to the extension field in the FAT structures; the FAT file system has fixed sized structures for the old short file names.

On modern file systems there's no fixed structure enforced and you may use any character that's not assigned a special meaning by the operating system.

These days you should strictly avoid the characters :, / and \ in file names to avoid cross plattform whoopsie-daysies.

On Windows/NTFS : identifies alternate data streams. / is the *nix path separator, that also works as such on Windows. On Windows \ is the path separator that's usually not understood as such by *nix-y systems (Linux, macOS, *BSD, Android). You can have a lot of fun by putting a \ in a file name on a *nix-y system, share it via CIFS/SMB (i.e. Windows network share) and have the whole thing trip over that.

Upvotes: 2

Juan Sancho
Juan Sancho

Reputation: 321

File readers need to know the extension of the file (to open it in the correct software). Dot is the separator of the file name and it's extension.

Upvotes: 0

Related Questions