2

I noticed a long time ago that a number of files included with projects, especially files called README, LICENSE, and so forth, frequently have no filename extension. This is strange to me because it requires the reader of such files to perform some extra commands to open it.

I visited Is it good programming practice to create files with no extension?, but while the answer suggests it's not good to have no filename extension, it doesn't answer my question of whether there is a motive in not including one.

I'd like to know if there are reasons not to include file extensions and what those reasons might be.

1 Answers1

8

It all depends on your operating system of choice and how they implemented metadata to assist with determining the file type.

Unix-based OS's traditionally use the first four bytes of the file to denote its type.The dot character isn't treated as anything special and no file extension is needed for well behaved utilities and apps to read a file correctly.

DOS, and later Windows, traditionally use "." as a special character to denote the end of the file name and the start of the file type metadata (the file extension). Apps in Windows typically rely on the extension to denote the file's type and to read it correctly.

Using the extension, eg README.txt, means the file is more portable, as Linux doesn't care about it and Windows knows what to do with it. That's the reason why it's generally recommended that they be used. If your world is very Linux-orientated and the README file won't typically be read by a Windows user, then there's little point in cluttering the filename with a .txt extension and not putting the extension on it fits better with Linux idioms.

David Arno
  • 39,599
  • 9
  • 94
  • 129