# Filename

Key: `technology.filesystem.filename`

A bare file name — a stem and a file extension, with no directory separators (report\_final.xlsx, IMG\_0042.png, archive.tar.gz). The named file entity, distinct from a path (windows\_path carries separators), a URL (no scheme/host), a bare word (a real file extension), and the file's properties (representation.file.extension/file\_size/mime\_type).

Page: <https://meridian.online/docs/projects/finetype/types/technology/filesystem/filename>

Samples: `report_final.xlsx`, `IMG_0042.png`, `archive.tar.gz`, `atarisy2.cpp`

## Background

### Origin

A filename is used to uniquely identify a computer file in a file system.[[1]](https://en.wikipedia.org/wiki/Filename) POSIX defines a filename as a sequence of bytes consisting of 1 to {NAME\_MAX} bytes used to name a file.[[2]](https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap03.html) Under POSIX, the bytes of a filename shall not contain the NUL or slash characters.[[2]](https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap03.html) POSIX defines a pathname as optional beginning slash characters followed by zero or more filenames separated by slash characters.[[2]](https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap03.html) POSIX gives the filenames dot and dot-dot special meaning.[[2]](https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap03.html) The POSIX portable filename character set is the letters A to Z and a to z, the digits 0 to 9, and the period, underscore and hyphen-minus.[[2]](https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap03.html)

Microsoft's Win32 documentation says all file systems follow the same general naming convention for an individual file: a base file name and an optional extension, separated by a period.[[3]](https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file) The older MS-DOS FAT file system supports a maximum of 8 characters for the base file name and 3 characters for the extension, commonly known as an 8.3 file name.[[3]](https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file) Wikipedia's Filename extension article says DEC's versions of the extension concept inspired later microcomputer operating systems to adopt it.[[4]](https://en.wikipedia.org/wiki/Filename_extension) Wikipedia's Filename extension article says the need to condense a file's type into three characters frequently led to abbreviated extensions.[[4]](https://en.wikipedia.org/wiki/Filename_extension)

FineType defines its filename type as a bare file name, a stem and a file extension, with no directory separators.[[5]](https://github.com/meridian-online/finetype/blob/main/labels/definitions_technology.yaml)

### Use

Windows reserves the characters \<, \>, :, ", /, \\, \|, ? and \* in file names.[[3]](https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file) Windows documentation says not to use reserved names such as CON, PRN, AUX and NUL for the name of a file.[[3]](https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file) Windows documentation says NUL.txt and NUL.tar.gz are both equivalent to NUL.[[3]](https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file) Windows documentation says not to end a file or directory name with a space or a period, because the Windows shell and user interface do not support such names.[[3]](https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file) Windows documentation says not to assume case sensitivity, treating OSCAR, Oscar and oscar as the same name.[[3]](https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file) By default, HFS+ and APFS in macOS are case-insensitive but case-preserving.[[1]](https://en.wikipedia.org/wiki/Filename) Before you deduplicate a column of filenames, decide whether Report.xlsx and report.xlsx are one file or two, because the answer depends on the system the names came from. (Meridian's view)

Wikipedia's Filename extension article says more than one extension usually represents nested transformations, such as files.tar.gz.[[4]](https://en.wikipedia.org/wiki/Filename_extension) Python's pathlib lists the suffixes of my/library.tar.gz as .tar and .gz.[[6]](https://docs.python.org/3/library/pathlib.html) Python's os.path.splitext ignores earlier periods, splitting foo.bar.exe into foo.bar and .exe.[[7]](https://docs.python.org/3/library/os.path.html) Python's os.path.splitext treats leading periods of the last component as part of the root, so .cshrc has no extension.[[7]](https://docs.python.org/3/library/os.path.html) Splitting on the last period is a fair default, but keep a list of compound extensions such as .tar.gz if you want archive.tar.gz grouped with other gzipped tarballs rather than with every other .gz file. (Meridian's view)

Wikipedia's Filename extension article says file extensions alone are not a reliable indicator of a file's type.[[4]](https://en.wikipedia.org/wiki/Filename_extension) Wikipedia's Filename extension article says Windows File Explorer by default does not display extensions, which malicious users have exploited with names like LOVE-LETTER-FOR-YOU.TXT.vbs.[[4]](https://en.wikipedia.org/wiki/Filename_extension) Treat the extension in a filename column as a claim about the file, not proof of its contents, and check the MIME type or the bytes when it matters. (Meridian's view)

## Sources

1. [Filename](https://en.wikipedia.org/wiki/Filename) — secondary source
2. [Definitions](https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap03.html) — standard
3. [Naming Files, Paths, and Namespaces - Win32 apps](https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file) — documentation
4. [Filename extension](https://en.wikipedia.org/wiki/Filename_extension) — secondary source
5. [finetype/labels/definitions\_technology.yaml at main · meridian-online/finetype](https://github.com/meridian-online/finetype/blob/main/labels/definitions_technology.yaml) — FineType
6. [pathlib — Object-oriented filesystem paths](https://docs.python.org/3/library/pathlib.html) — documentation
7. [os.path — Common pathname manipulations](https://docs.python.org/3/library/os.path.html) — documentation
