Filename extension: Difference between revisions

Content deleted Content added
Combine the "Operating system handling", "File system support", and "History" sections into one "Operating system and file system support" section, removing redundant information.
No edit summary
 
(37 intermediate revisions by 30 users not shown)
Line 2:
{{more citations needed|date=November 2015}}
A '''filename extension''', '''file name extension''' or '''file extension''' is a suffix to the [[filename|name]] of a [[computer file]] (for example, <code>.txt</code>, <code>.docx</code>, <code>.md</code>). The extension indicates a characteristic of the file contents or its intended use. A filename extension is typically delimited from the rest of the filename with a [[full stop]] (period), but in some systems<ref>{{cite manual
| title = z/VM - Version 7 Release 1 -.2 CMS Primer
| id = SC24-6265-0001
| section = What Is a File?
| section-url = https://www.ibm.com/servers/resourcelink/svc0302a.nsf/pages/zVMV7R1sc246265zVMV7R2sc246265/$file/dmsb2_v7r1dmsb2_v7r2.pdf#page=2123
| page = 7
| quote = One thing you need to know about creating files with z/VM is that each file needs its own three-part identifier. The first part of the identifier is the file name. The second part is the file type. And the third part is the file mode. These three file identifiers are often abbreviated fn ft fm.
| date = 20182021-0912-1105
| url = https://www.ibm.com/servers/resourcelink/svc0302a.nsf/pages/zVMV7R1sc246265zVMV7R2sc246265/$file/dmsb2_v7r1dmsb2_v7r2.pdf
| publisher = IBM
}}
Line 20:
The [[Multics]] file system stores the file name as a single string, not split into base name and extension components, allowing the "." to be just another character allowed in file names. It allows for variable-length filenames, permitting more than one dot, and hence multiple suffixes, as well as no dot, and hence no suffix. Some components of Multics, and applications running on it, use suffixes to indicate file types, but not all files are required to have a suffix — for example, executables and ordinary text files usually have no suffixes in their names.
 
File systems for [[UNIX-like]] operating systems also store the file name as a single string, with "." as just another character in the file name. A file with more than one suffix is sometimes said to have more than one extension, although terminology varies in this regard, and most authors define ''extension'' in a way that does not allow more than one in the same file name.{{cn|date=November 2023}} More than one extension usually represents nested transformations, such as <code>files.tar.gz</code> (the <code>.tar</code> indicates that the file is a [[tar (computing)|tar archive]] of one or more files, and the <code>.gz</code> indicates that the tar archive file is compressed with [[gzip]]). Programs transforming or creating files may add the appropriate extension to names inferred from input file names (unless explicitly given an output file name), but programs reading files usually ignore the information; it is mostly intended for the human user.
It is more common, especially in binary files, for the file to contain [[File format#Internal metadata|internal]] or [[File format#External metadata|external]] metadata describing its contents.
This model generally requires the full filename to be provided in commands, whereas the metadata approach often allows the extension to be omitted.
 
In [[DOS]] and 16-bit [[Microsoft Windows|Windows]], file names have a maximum of 8 characters, a period, and an extension of up to three letters. The [[File Allocation Table|FAT]] file system for DOS and Windows stores file names as an 8-character name and a three-character extension. The period character is not stored.
 
The [[High Performance File System]] (HPFS), used in Microsoft and [[IBM]]'s [[OS/2]] stores the file name as a single string, with the "." character as just another character in the file name. The convention of using suffixes continued, even though HPFS supports extended attributes for files, allowing a file's type to be stored in the file as an extended attribute.
Line 32:
[[Windows 95]], with VFAT, introduced support for long file names, and removed the 8.3 name/extension split in file names from non-NT Windows.
 
The [[classic Mac OS]] disposed of filename-based extension metadata entirely; it used, instead, a distinct file [[type code]] to identify the file format. Additionally, a [[creator code]] was specified to determine which application would be launched when the file's [[Icon (computing)|icon]] was [[double-click]]ed.<ref>{{Webcite citationweb|url=https://livecode.byu.edu/helps/file-creatorcodes.php|title=Mac Creator and File Type codes|accessdate=2022-09-02|website=livecode.byu.edu}}</ref> [[macOS]], however, uses filename suffixes as a consequence of being derived from the UNIX-like [[NeXTSTEP]] operating system, in addition to using type and creator codes.
 
In Commodore systems, files can only have four extensions: PRG, SEQ, USR, REL. However, these are used to separate data types used by a program and are irrelevant for identifying their contents.
Line 47:
 
== Content type ==
Filename extensions may be considered a type of [[metadata]].<ref name="Stauffer et al 2017">{{cite book|last1=Stauffer|first1=Todd|last2=McElhearn|first2=Kirk|title=Mastering Mac OS X|date=2006|publisher=John Wiley & Sons|isbn=9780782151282|pages=95–96|url=https://books.google.com/books?id=62xkJo6JXwAC&pg=PA95|access-date=2 October 2017|language=en}}</ref> They are commonly used to imply information about the way data might be stored in the file. The exact definition, giving the criteria for deciding what part of the file name is its extension, belongs to the rules of the specific [[file system]] used; usually the extension is the substring which follows the last occurrence, if any, of the [[full stop|dot character]] (''example:'' <code>txt</code> is the extension of the filename <code>readme.txt</code>, and <code>html</code> the extension of <code>mysite.index.html</code>).
On file systems of some mainframe systems such as [[Conversational Monitor System|CMS]] in [[VM (operating system)|VM]], [[OpenVMS|VMS]], and of PC systems such as [[CP/M]] and derivative systems such as [[MS-DOS]], the extension is a separate [[namespace]] from the filename. Under Microsoft's [[DOS]] and [[Microsoft Windows|Windows]], extensions such as <code>[[EXE]]</code>, <code>COM</code> or <code>BAT</code> indicate that a file is a program [[executable]]. In [[OS/360 and successors]], the part of the dataset name following the last period, called the low level qualifier, is treated as an extension by some software, e.g., [[Time Sharing Option|TSO]] EDIT, but it has no special significance to the operating system itself; the same applies to Unix files in MVS.