Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Filename
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{short description|Text string used to uniquely identify a computer file}} {{Use mdy dates|date=October 2017}} [[File:Dir command in Windows Command Prompt.png|thumb|Screenshot of a [[Microsoft Windows|Windows]] command shell showing filenames in a directory]] [[File:EMule v.049b.JPG|thumb|Filename list, with long filenames containing comma and space characters as they appear in a software display.]] A '''filename''' or '''file name''' is a name used to uniquely identify a [[computer file]] in a [[file system]]. Different file systems impose different restrictions on filename lengths. A filename may (depending on the file system) include: * '''name''' – base name of the file * '''[[Filename extension|extension]]''' – may indicate the [[File format|format of the file]] (e.g. <code>.txt</code> for [[plain text]], <code>.pdf</code> for [[Portable Document Format]], <code>[[.dat]]</code> for unspecified binary data, etc.) The components required to identify a file by utilities and applications varies across operating systems, as does the syntax and format for a valid filename. The characters allowed in filenames depend on the file system. The letters A–Z and digits 0–9 are allowed by most file systems; many file systems support additional characters, such as the letters a–z, special characters, and other printable characters such as accented letters, symbols in non-Roman alphabets, and symbols in non-alphabetic scripts. Some file systems allow even unprintable characters, including [[Bell character|Bell]], [[Null character|Null]], [[Carriage Return|Return]] and [[Linefeed]], to be part of a filename,<ref>{{cite web |title=Fixing Unix/Linux/POSIX Filenames: Control Characters (such as Newline), Leading Dashes, and Other Problems |url=https://dwheeler.com/essays/fixing-unix-linux-filenames.html |author=David A. Wheeler |date=2023-08-22<!-- (originally 2009-03-24) --> |access-date=2024-07-14 |url-status=live |archive-url=https://web.archive.org/web/20240525183611/https://dwheeler.com/essays/fixing-unix-linux-filenames.html |archive-date=2024-05-25 }}</ref> although most utilities do not handle them well. Filenames may include things like a revision or generation number of the file, a numerical sequence number (widely used by [[digital camera]]s through the [[Design rule for Camera File system|''DCF'' standard]]), a date and time (widely used by [[smartphone camera]] software and for [[screenshot]]s), or a comment such as the name of a subject or a location or any other text to help identify the file. Some people use the term filename when referring to a complete specification of device, subdirectories and filename such as the Windows ''C:\Program Files\Microsoft Games\Chess\Chess.exe''. The filename in this case is ''Chess.exe''. Some utilities have settings to suppress the extension as with MS Windows Explorer.{{Not verified in body|date=July 2023}} ==History== During the 1970s, some [[mainframe]] and [[minicomputers]] had operating systems where files on the system were identified by a user name, or account number. For example, on the [[TOPS-10]] and [[RSTS/E]] operating systems from [[Digital Equipment Corporation]], files were identified by * optional device name (one or two characters) followed by an optional unit number, and a colon ":". If not present, it was presumed to be SY: * the account number, consisting of a bracket "[", a pair of numbers separated by a comma, and followed by a close bracket "]". If omitted, it was presumed to be yours. * mandatory file name, consisting of 1 to 6 characters (upper-case letters or digits) * optional 3-character extension. On the [[OS/360 and successors|OS/360 and successor]] operating systems from [[IBM]], a file name can be up to 44 characters, consisting of upper case letters, digits, and the period; a file name had to start with a letter or number, a period must occur at least once each 8 characters, two consecutive periods can not appear in the name, and the name must end with a letter or digit.<ref>{{cite book |url=https://bitsavers.org/pdf/ibm/360/os/R01-08/C28-6535-0_OS360_Concepts_and_Facilities_1965.pdf |title=IBM Operating System/360 Concepts and Facilities |page=23 |publisher=IBM |id=C28-6535-0 |date=1965}}</ref><ref name="44_char">{{cite web|title=Data Set Naming Rules |work=z/OS TSO/E User's Guide |publisher=IBM |url=https://www.ibm.com/docs/en/zos/3.1.0?topic=conventions-data-set-naming-rules}}</ref> By convention, when using [[Time Sharing Option|TSO]], the letters and numbers before the first period is the account number of the owner or the project it belongs to, but there is no requirement to use this convention.<ref>{{cite web|title=Data Set Naming Conventions |work=z/OS TSO/E User's Guide |publisher=IBM |url=https://www.ibm.com/docs/en/zos/3.1.0?topic=conventions-data-set-naming}}</ref> On the McGill University [[MUSIC/SP]] system, file names consisted of * Optional account number, which was one to four characters followed by a colon.If the account number was missing, it was presumed to be in your account, but if it was not, it was presumed to be in the *COM: pseudo-account, which is where all files marked as public were catalogued. * 1–17 character file name, which could be upper case letters or digits, and the period, with the requirement it not begin or end with a period, or have two consecutive periods. The Univac [[VS/9]] operating system had file names consisting of *Account name, consisting of a dollar sign "$", a 1-7 character (letter or digit) username, and a period ("."). If not present it was presumed to be in your account, but if it was not, the operating system would look in the system manager's account $TSOS. If you typed in a dollar sign only as the account, this would indicate the file was in the $TSOS account ''unless'' the first 1–7 character of the file name before the first period matched an actual account name, then that account was used, e.g. ABLE.BAKER is a file in your account, but if not there the system would search for $TSOS.ABLE.BAKER, but if $ABLE.BAKER was specified, the file $TSOS.ABLE.BAKER would be used ''unless'' $ABLE was a valid account, then it would look for a file named BAKER in that account. * File name, 1–56 characters (letters and digits) separated by periods. File names cannot start or end with a period, nor can two consecutive periods appear. In 1985, {{IETF RFC|959}} officially defined a ''pathname'' to be the character string that must be entered into a file system by a user in order to identify a file.<ref>{{cite IETF|rfc=959|title=File Transfer Protocol (FTP)}}</ref> On early [[personal computer]]s using the [[CP/M]] operating system, filenames were always 11 characters. This was referred to as the [[8.3 filename]] with a maximum of an 8 byte name and a maximum of a 3 byte extension. Utilities and applications allowed users to specify filenames without trailing spaces and include a dot before the extension. The dot was not actually stored in the directory. Using only 7 bit characters allowed several [[file attributes]] to be included in the actual filename by using the high-order-bit; these attributes included Readonly, Archive, and System.<ref>{{cite web | url=https://www.cpm8680.com/cpmtools/cpm.htm | title=CPM - CP/M disk and file system format }}</ref> Eventually this was too restrictive and the number of characters allowed increased. The attribute bits were moved to a special block of the file including additional information.{{citation needed|date=October 2023}} The original [[File Allocation Table]] (FAT) file system, used by [[Standalone Disk BASIC-80]], had a 6.3 file name, with a maximum of 6 bytes in the name and a maximum of 3 bytes in the extension. The [[FAT12]] and [[FAT16]] file systems in [[IBM PC DOS]]/[[MS-DOS]] and [[Microsoft Windows]] prior to [[Windows 95]] used the same 8.3 convention as the CP/M file system. The FAT file systems supported 8-bit characters, allowing them to support non-ASCII characters in file names, and stored the attributes separately from the file name. Around 1995, [[VFAT]], an extension to the MS-DOS FAT filesystem, was introduced in [[Windows 95]] and [[Windows NT]]. It allowed mixed-case [[long filename]]s (LFNs), using [[Unicode]] characters, in addition to classic "8.3" names. == File naming schemes == Programs and devices may automatically assign names to files such as a numerical counter (for example <code>IMG_0001.JPG</code>) or a time stamp with the current date and time. The benefit of a time stamped file name is that it facilitates searching files by date, given that [[file managers]] usually feature file searching by name. In addition, files from different devices can be merged in one folder without file naming conflicts. Numbered file names, on the other hand, do not require that the device has a correctly set internal clock. For example, some [[digital camera]] users might not bother setting the clock of their camera. Internet-connected devices such as smartphones may synchronize their clock from a NTP server. ==References: absolute vs relative== {{Main|Path (computing)}} An absolute reference includes all directory levels. In some systems, a filename reference that does not include the complete directory path defaults to the [[current working directory]]. This is a relative reference. One advantage of using a relative reference in program configuration files or scripts is that different instances of the script or program can use different files. This makes an absolute or relative path composed of a sequence of filenames. ==Number of names per file== Unix-like file systems allow a file to have more than one name; in traditional Unix-style file systems, the names are [[hard link]]s to the file's [[inode]] or equivalent. Windows supports hard links on [[NTFS]] file systems, and provides the command <code>fsutil</code> in Windows XP, and <code>mklink</code> in later versions, for creating them.<ref>{{cite web|title=Fsutil command description page|publisher=Microsoft.com|access-date=September 15, 2013|url=http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/fsutil.mspx?mfr=true|archive-url=https://web.archive.org/web/20131006013745/http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/fsutil.mspx?mfr=true|archive-date=October 6, 2013|url-status=dead}}</ref><ref>{{cite web|title=NTFS Hard Links, Directory Junctions, and Windows Shortcuts|url=http://www.flexhex.com/docs/articles/hard-links.phtml|work=Flex hex|publisher=Inv Softworks|access-date=March 12, 2011|archive-url=https://web.archive.org/web/20110711005950/http://www.flexhex.com/docs/articles/hard-links.phtml|archive-date=July 11, 2011|url-status=usurped}}</ref> Hard links are different from Windows [[Computer shortcut|shortcuts]], classic Mac OS/macOS [[Alias (Mac OS)|aliases]], or [[symbolic link]]s. The introduction of [[Long filename|LFN]]s with [[VFAT]] allowed filename aliases. For example, <code>longfi~1.???</code> with a maximum of eight plus three characters was a filename alias of "<code>long file name.???</code>" as a way to conform to 8.3 limitations for older programs. This property was used by the move command algorithm that first creates a second filename and then only removes the first filename. Other filesystems, by design, provide only one filename per file, which guarantees that alteration of one filename's file does not alter the other filename's file. == {{anchor|6.3|8.3|18.3}}Length restrictions == Some filesystems restrict the length of filenames. In some cases, these lengths apply to the entire file name, as in 44 characters in IBM [[z/OS]].<ref name="44_char" /> In other cases, the length limits may apply to particular portions of the filename, such as the name of a file in a directory, or a directory name. For example, 9 (e.g., [[8-bit FAT]] in [[Standalone Disk BASIC]]), 11 (e.g. [[FAT12]], [[FAT16]], [[FAT32]] in DOS), 14 (e.g. early Unix), 21 ([[Human68K]]), 31<!--which OS?-->, 30 (e.g. [[Apple DOS]] 3.2 and 3.3), 15 (e.g. [[Apple ProDOS]]), 44 (e.g. IBM S/370),<ref name="44_char"/> or 255 (e.g. early Berkeley Unix) characters or bytes. Length limits often result from assigning fixed space in a filesystem to storing components of names, so increasing limits often requires an incompatible change, as well as reserving more space. A particular issue with filesystems that store information in nested directories is that it may be possible to create a file with a complete pathname that exceeds implementation limits, since length checking may apply only to individual parts of the name rather than the entire name. Many Windows applications are limited to a <code>MAX_PATH</code> value of 260, but Windows file names can easily exceed this limit.<ref name="naming-files-paths-and-namespaces-windows">{{cite web|url=https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file|title=Naming Files, Paths, and Namespaces|date=December 15, 2022|access-date=October 8, 2023}}</ref> From [[Windows 10 version history (version 1607)|Windows 10, version 1607]], MAX_PATH limitations have been removed.<ref>{{cite web|url=https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation|title=Maximum Path Length Limitation - Win32 apps|date=July 18, 2022 }}</ref> == Filename extensions == {{Main article|Filename extension}} Filenames in some file systems, such as [[File Allocation Table|FAT]] and the ODS-1 and ODS-2 levels of [[Files-11]], are composed of two parts: a ''base name'' or ''stem'' and an ''extension'' or ''suffix'' used by some applications to indicate the [[file type]]. Some other file systems, such as [[Unix]] file systems, [[VFAT]], and [[NTFS]], treat a filename as a single string; a convention often used on those file systems is to treat the characters following the last period in the filename, in a filename containing periods, as the extension part of the filename. Multiple output files created by an application may use the same basename and various extensions. For example, a Fortran compiler might use the extension <code>FOR</code> for source input file, <code>OBJ</code> for the object output and <code>LST</code> for the listing. Although there are some common extensions, they are arbitrary and a different application might use <code>REL</code> and <code>RPT</code>. Extensions have been restricted, at least historically on some systems, to a length of 3 characters, but in general can have any length, e.g., <code>html</code>. ==Encoding interoperability== There is no general encoding standard for filenames. File names have to be exchanged between software environments for network file transfer, file system storage, backup and file synchronization software, configuration management, data compression and archiving, etc. It is thus very important not to lose file name information between applications. This led to wide adoption of Unicode as a standard for encoding file names, although legacy software might not be Unicode-aware. ===Encoding indication interoperability=== Traditionally, filenames allowed any character in their filenames as long as they were file system safe.<ref name="solaris presentations IUC29-FileSystems" /> Although this permitted the use of any encoding, and thus allowed the representation of any local text on any local system, it caused many interoperability issues. A filename could be stored using different byte strings in distinct systems within a single country, such as if one used Japanese [[Shift JIS]] encoding and another Japanese [[EUC-JP|EUC]] encoding. Conversion was not possible as most systems did not expose a description of the encoding used for a filename as part of the extended file information. This forced costly filename encoding guessing with each file access.<ref name="solaris presentations IUC29-FileSystems">{{cite web|author=David Robinson|author2=Ienup Sung|author3=Nicolas Williams |date=March 2006 |url=http://developers.sun.com/global/products_platforms/solaris/reference/presentations/IUC29-FileSystems.pdf |title=Solaris presentations: File Systems, Unicode, and Normalization |location=San Francisco |publisher=Sun.com |url-status=dead |archive-url=https://web.archive.org/web/20120704003732/http://developers.sun.com/global/products_platforms/solaris/reference/presentations/IUC29-FileSystems.pdf |archive-date=July 4, 2012 }}</ref> A solution was to adopt Unicode as the encoding for filenames. In the classic Mac OS, however, encoding of the filename was stored with the filename attributes.<ref name="solaris presentations IUC29-FileSystems" /> ===Unicode interoperability=== The Unicode standard solves the encoding determination issue. Nonetheless, some limited interoperability issues remain, such as normalization (equivalence), or the Unicode version in use. For instance, UDF is limited to Unicode 2.0; macOS's [[HFS+]] file system applies NFD Unicode normalization and is optionally case-sensitive (case-insensitive by default.) Filename maximum length is not standard and might depend on the code unit size. Although it is a serious issue, in most cases this is a limited one.<ref name="solaris presentations IUC29-FileSystems" /> On Linux, this means the filename is not enough to open a file: additionally, the exact byte representation of the filename on the storage device is needed. This can be solved at the application level, with some tricky normalization calls.<ref>{{cite web|url=http://nedbatchelder.com/blog/201106/filenames_with_accents.html |title=Filenames with accents |date=June 2011 |publisher=Ned Batchelder |access-date=September 17, 2013}}</ref> The issue of Unicode equivalence is known as "normalized-name collision". A solution is the ''Non-normalizing Unicode Composition Awareness'' used in the Subversion and Apache technical communities.<ref>{{cite web|url=https://cwiki.apache.org/confluence/display/SVN/NonNormalizingUnicodeCompositionAwareness |title=NonNormalizingUnicodeCompositionAwareness - Subversion Wiki |publisher=Wiki.apache.org |date=January 21, 2013 |access-date=October 8, 2023}}</ref> This solution does not normalize paths in the repository. Paths are only normalized for the purpose of comparisons. Nonetheless, some communities have patented this strategy, forbidding its use by other communities.{{clarify|A patent cannot be held by multiple communities (patent-holders)|date=February 2013}} ===Perspectives=== To limit interoperability issues, some ideas described by Sun are to: * use one Unicode encoding (such as UTF-8) * do transparent code conversions on filenames * store no normalized filenames * check for canonical equivalence among filenames, to avoid two canonically equivalent filenames in the same directory.<ref name="solaris presentations IUC29-FileSystems" /> Those considerations create a limitation not allowing a switch to a future encoding different from UTF-8. === Unicode migration === One issue was migration to Unicode. For this purpose, several software companies provided software for migrating filenames to the new Unicode encoding. * Microsoft provided migration transparent for the user throughout the VFAT technology * Apple provided "File Name Encoding Repair Utility v1.0".<ref>{{cite web|date=June 1, 2006|title=File Name Encoding Repair Utility v1.0|url=https://support.apple.com/kb/DL355|access-date=October 2, 2018|publisher=Support.apple.com}}</ref> * The Linux community provided "[[convmv]]".<ref>{{cite web|title=convmv - converts filenames from one encoding to another|url=http://www.j3e.de/linux/convmv/man/|access-date=September 17, 2013|publisher=J3e.de}}</ref> [[Mac OS X 10.3]] marked Apple's adoption of Unicode 3.2 character decomposition, superseding the Unicode 2.1 decomposition used previously. This change caused problems for developers writing software for Mac OS X.<ref>{{cite web|date=May 7, 2010|title=Re: git on MacOSX and files with decomposed utf-8 file names|url=http://kerneltrap.org/mailarchive/git/2008/1/23/593749/thread|url-status=dead|archive-url=https://web.archive.org/web/20110315014244/http://kerneltrap.org/mailarchive/git/2008/1/23/593749/thread|archive-date=March 15, 2011|access-date=July 5, 2010|publisher=KernelTrap}}</ref> == Uniqueness == Within a single directory, filenames must be unique. Since the filename syntax also applies for directories, it is not possible to create a file and directory entries with the same name in a single directory. Multiple files in different directories may have the same name. Uniqueness approach may differ both on the case sensitivity and on the [[Unicode equivalence|Unicode normalization form]] such as NFC, NFD. This means two separate files might be created with the same text filename and a different byte implementation of the filename, such as L"\x00C0.txt" (UTF-16, NFC) (Latin capital A with grave) and L"\x0041\x0300.txt" (UTF-16, NFD) (Latin capital A, grave combining).<ref>{{cite web|url=https://www.gamedev.net/forums/topic/628734-cross-platform-filepath-naming-conventions/ |title=Cross platform filepath naming conventions - General Programming |publisher=GameDev.net |access-date=October 8, 2023}}</ref> == Letter case preservation == Some filesystems, such as [[File Allocation Table|FAT]] prior to the introduction of [[VFAT]], store filenames as upper-case regardless of the [[letter case]] used to create them. For example, a file created with the name "MyName.Txt" or "myname.txt" would be stored with the filename "MYNAME.TXT" (VFAT preserves the letter case). Any variation of upper and lower case can be used to refer to the same file. These kinds of file systems are called '''case-insensitive''' and are not '''case-preserving'''. Some filesystems prohibit the use of lower case letters in filenames altogether. Some file systems store filenames in the form that they were originally created; these are referred to as '''case-retentive''' or '''case-preserving'''. Such a file system can be '''case-sensitive''' or '''case-insensitive'''. If case-sensitive, then "MyName.Txt" and "myname.txt" may refer to two different files in the same directory, and each file must be referenced by the exact capitalization by which it is named. On a case-insensitive, case-preserving file system, on the other hand, only one of "MyName.Txt", "myname.txt" and "Myname.TXT" can be the name of a file in a given directory at a given time, and a file with one of these names can be referenced by any capitalization of the name. From its original inception, the file systems on Unix and its derivative systems were case-sensitive and case-preserving. However, not all file systems on those systems are case-sensitive; by default, [[HFS+]] and [[APFS]] in [[macOS]] are case-insensitive but case-preserving, and [[Server Message Block|SMB]] servers usually provide case-insensitive behavior (even when the underlying file system is case-sensitive, e.g. [[Samba (software)|Samba]] on most Unix-like systems), and SMB client file systems provide case-insensitive behavior. File system [[case sensitivity]] is a considerable challenge for software such as Samba and [[Wine (software)|Wine]], which must interoperate efficiently with both systems that treat uppercase and lowercase files as different and with systems that treat them the same.<ref>{{cite web |url=http://wiki.winehq.org/CaseInsensitiveFilenames |title=CaseInsensitiveFilenames - The Official Wine Wiki |publisher=Wiki.winehq.org |date=November 8, 2009 |access-date=August 20, 2010 |archive-url=https://web.archive.org/web/20100818055054/http://wiki.winehq.org/CaseInsensitiveFilenames |archive-date=August 18, 2010 |url-status=dead }}</ref> == Reserved characters and words == {{redirect|Reserved characters|characters that cannot be used in page titles on Wikipedia|Wikipedia:Naming conventions (technical restrictions)#Forbidden characters|selfref=y}} <!--[[Reserved character]] and [[Reserved characters]] redirect here--> File systems have not always provided the same character set for composing a filename. Before [[Unicode]] became a de facto standard, file systems mostly used a locale-dependent character set. By contrast, some new systems permit a filename to be composed of almost any character of the Unicode repertoire, and even some non-Unicode byte sequences. Limitations may be imposed by the file system, operating system, application, or requirements for interoperability with other systems. Many file system utilities prohibit [[control character]]s from appearing in filenames. In Unix-like file systems, the {{anchor|null}}[[null character]]<ref name=OpenGroup>{{cite web|title=The Open Group Base Specifications Issue 6|url=http://pubs.opengroup.org/onlinepubs/007904875/basedefs/xbd_chap03.html#tag_03_169 |work=IEEE Std 1003.1-2001 |publisher=The Open Group|year=2001}}</ref> and the path separator <code>/</code> are prohibited. === Problematic characters <span class="anchor" id="In Windows"></span>=== File system utilities and naming conventions on various systems prohibit particular characters from appearing in filenames or make them problematic:<ref name="naming-files-paths-and-namespaces-windows" /> Except as otherwise stated, the symbols in the '''Character''' column, {{Char|"}} and {{Char|<}} for example, cannot be used in Windows filenames. {| class="wikitable" |- ! style="width:10%;"|Character ! style="width:15%;"|Name ! style="width:75%;"|Reason for prohibition |- | style="text-align:center;"| <code>/</code> | [[slash (punctuation)|slash]] | Used as a path name component separator in Unix-like, Windows, and Amiga systems. (For as long as the [[SwitChar]] setting is set to {{char|/}}, the DOS [[COMMAND.COM]] shell would consume it as a switch character, but DOS and Windows themselves always accept it as a separator on API level.)<br />The big solidus {{char|⧸}} ([[Unicode#Architecture and terminology|Unicode code point]] U+29F8) is permitted in Unix and Windows filenames. |- | style="text-align:center;"| <code>\</code> | [[backslash]] | Used as the default path name component separator in DOS, OS/2 and Windows (even if the [[SwitChar]] is set to '-'; allowed in Unix filenames, see [[#Anc1|Note 1]]).<br />The big reverse solidus {{char|⧹}} (U+29F9) is permitted in Windows filenames. |- | style="text-align:center;"| <code>?</code> | [[question mark]] | Used as a wildcard in Unix, Windows and [[AmigaOS]]; marks a single character. Allowed in Unix filenames, see [[#Anc1|Note 1]].<br />The [[glottal stop]] {{char|ʔ}} (U+0294), the [[interrobang]] {{char|‽}} (U+203D), the [[inverted question mark]] {{char|¿}} (U+00BF), the double question mark {{char|⁇}} (U+2047), and the black question mark ornament❓(U+2753) are allowed in all filenames. |- | style="text-align:center;"| <code>%</code> | [[percent sign|percent]] | Used as a wildcard in [[RT-11]]; marks a single character. Not special on Windows. |- | style="text-align:center;"| <code>*</code> | [[asterisk]]<br /> ''or'' star | Used as a wildcard in Unix, DOS, RT-11, VMS and Windows. Marks any sequence of characters (Unix, Windows, DOS) or any sequence of characters in either the basename or extension (thus {{Code|*.*}} in DOS means "all files"). Allowed in Unix filenames, see [[#Anc1|Note 1]].<br />See [[Star (glyph)]] for many asterisk-like characters allowed in filenames. |- | style="text-align:center;"| <code>:</code> | [[colon (punctuation)|colon]] | Used to determine the mount point / drive on Windows; used to determine the virtual device or physical device such as a drive on AmigaOS, [[RT-11]] and VMS; used as a pathname separator in [[classic Mac OS]]. Doubled after a name on VMS, indicates the DECnet nodename (equivalent to a NetBIOS [Windows networking] hostname preceded by {{Code|\\}}.) Colon is also used in Windows to separate an [[Alternate data stream|alternative data stream]] from the main file.<br />The [[Colon (letter)|letter colon]] {{char|꞉}} (U+A789) and the [[Ratio#Notation and terminology|ratio symbol]] {{char|∶}} (U+2236) are permitted in Windows filenames. In the [[Segoe UI]] font, used in [[Windows Explorer]], the [[glyph]]s for the colon and the letter colon are identical. |- | style="text-align:center;"| <code><nowiki>|</nowiki></code> | [[vertical bar]]<br /> ''or'' pipe | Designates [[Pipeline (Unix)|software pipelining]] in Unix, DOS and Windows; allowed in Unix filenames, see [[#Anc1|Note 1]]. The [[mathematical operator]] divides {{Char|∣}} (U+2223) is permitted in Windows filenames. |- | style="text-align:center;"| <code>"</code> | [[quotation mark|straight double quote]] | A legacy restriction carried over from DOS. The single quotes {{Char|'}} (U+0027), {{Char|‘}} (U+2018), and {{Char|’}} (U+2019) and the curved double quotes left double quotation mark {{Char|“}} (U+201C) and right double quotation mark {{Char|”}} (U+201D) are permitted anywhere in filenames. See [[#Anc1|Note 1]]<!-- allowed in Unix -->. |- | style="text-align:center;"| <code><</code> | [[Inequality (mathematics)|less than]] | Used to [[Redirection (computing)|redirect input]], allowed in Unix filenames, see [[#Anc1|Note 1]]. The [[spacing modifier letter]] left arrowhead {{Char|˂}} (U+02C2) is permitted in Windows filenames. |- | style="text-align:center;"| <code>></code> | [[Inequality (mathematics)|greater than]] | Used to [[Redirection (computing)|redirect output]], allowed in Unix filenames, see [[#Anc1|Note 1]]. The [[spacing modifier letter]] right arrowhead {{Char|˃}} (U+02C3) is permitted in Windows filenames. |- | style="text-align:center;"| <code>.</code> | [[full stop|period]]<br /> ''or'' dot | [[Folder (computing)|Folder]] names cannot end with a period in Windows, though the name can end with a period followed by a [[whitespace character]] such as a [[non-breaking space]]. Elsewhere, the period is allowed, but the last occurrence will be interpreted to be the extension separator in VMS, DOS, and Windows. In other OSes, usually considered as part of the filename, and more than one period (full stop) may be allowed. In Unix, a leading period means the file or folder is normally hidden. |- | style="text-align:center;"| <code>,</code> | [[comma]] | Allowed, but treated as separator by the command line interpreters COMMAND.COM and CMD.EXE on DOS and Windows. |- | style="text-align:center;"| <code>;</code> | [[semicolon]] | Allowed, but treated as separator by the command line interpreters [[Bourne shell]] (and compatibles) and [[C shell]] (and compatibles) on Unix-like systems, and COMMAND.COM and CMD.EXE on DOS and Windows. See [[#Anc1|Note 1]]. |- | style="text-align:center;"| <code>=</code> | [[equals sign]] | Allowed, but treated as separator by the command line interpreters COMMAND.COM and CMD.EXE on DOS and Windows. |- | style="text-align:center;"| <code> </code> | [[Space (punctuation)|space]]<br /> | Allowed, but the space is also used as a parameter separator in [[command line]] applications; see [[#Anc1|Note 1]]. |} {{Anchor|Anc1}}Note 1: While they are allowed in Unix file and folder names, most [[Unix shell]]s require specific characters such as spaces, <, >, |, \, and sometimes :, (, ), &, ;, #, as well as wildcards such as ? and *, to be quoted or [[Escape character|escaped]]: <blockquote><code>five\ and\ six\<seven</code> (example of escaping)<br /><code>'five and six<seven'</code> or <code>"five and six<seven"</code> (examples of quoting)</blockquote> The character {{char|å}} (<code>0xE5</code>) was not allowed as the first letter in a filename under [[86-DOS]] and MS-DOS/PC DOS 1.x-2.x, but can be used in later versions. In Windows utilities, the space and the period are not allowed as the final character of a filename.<ref>[http://msdn.microsoft.com/en-us/library/aa365247.aspx#naming_conventions "Windows Naming Conventions"]. [[MSDN]], Microsoft.com. See last bulleted item.</ref> The period is allowed as the first character, but some Windows applications, such as [[Windows Explorer]], forbid creating or renaming such files (despite this convention being used in Unix-like systems to describe [[hidden file]]s and directories). Workarounds include appending a dot when renaming the file (that is then automatically removed afterwards), using alternative [[file manager]]s, creating the file using the command line, or saving a file with the desired filename from within an application.<ref name="win">[http://msdn.microsoft.com/en-us/library/aa365247.aspx Naming a file] ''msdn.microsoft.com'' (MSDN), filename restrictions on Windows</ref> Some file systems on a given operating system (especially file systems originally implemented on other operating systems), and particular applications on that operating system, may apply further restrictions and interpretations. See [[comparison of file systems]] for more details on restrictions. In Unix-like systems, DOS, and Windows, the filenames "." and ".." have special meanings (current and parent directory respectively). [[Windows 9x|Windows 95/98/ME]] also uses names like "...", "...." and so on to denote grandparent or great-grandparent directories.<ref>{{citation|url=https://support.microsoft.com/kb/135893|title=Microsoft Windows 95 README for Tips and Tricks|publisher=Microsoft|archive-url=https://web.archive.org/web/20141101063631/https://support.microsoft.com/kb/135893|archive-date=2014-11-01|url-status=dead}}</ref> All Windows versions forbid creation of filenames that consist of only dots, although names consisting of three dots ("...") or more are legal in Unix. In addition, in Windows and DOS utilities, some words are also reserved and cannot be used as filenames.<ref name="win"/> For example, DOS [[device file]]s:<ref>{{citation |url=http://support.microsoft.com/kb/74496 |publisher=[[Microsoft]] |title=MS-DOS Device Driver Names Cannot be Used as File Names |archive-url=https://web.archive.org/web/20140320154034/http://support.microsoft.com/kb/74496 |archive-date=2014-03-20 |url-status=dead}}</ref> CON, CONIN$, CONOUT$, PRN, AUX, CLOCK$, NUL COM0, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9<ref name="naming-files-paths-and-namespaces-windows" /> LPT0, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9<ref name="naming-files-paths-and-namespaces-windows" /> LST (only in [[86-DOS]] and DOS 1.xx) KEYBD$, SCREEN$ (only in multitasking [[MS-DOS 4.0 (multitasking)|MS-DOS 4.0]]) $IDLE$ (only in [[Concurrent DOS 386]], [[Multiuser DOS]] and [[DR DOS 5.0]] and higher) CONFIG$ (only in MS-DOS 7.0-8.0) Systems that have these restrictions cause incompatibilities with some other filesystems. For example, Windows will fail to handle, or raise error reports for, these legal UNIX filenames: aux.c,<ref>{{Cite web |url=http://heirloom.sourceforge.net/mailx_aux_c.html |title=The tale of "aux.c" |last=Ritter |first=Gunnar |date=2007-01-30 |website=Heirloom Project}}</ref> q"uote"s.txt, or NUL.txt.<!-- Windows XP filesystem has no problem with file.aux --> NTFS filenames that are used internally include: $Mft, $MftMirr, $LogFile, $Volume, $AttrDef, $Bitmap, $Boot, $BadClus, $Secure, $Upcase, $Extend, $Quota, $ObjId and $Reparse == Comparison of filename limitations == {{Main|Comparison of file systems}} {| class="wikitable sortable" style="font-size: 85%; text-align: center; width: 100%;" |- ! System ! Case<br />sensitive ! Case<br />preserving ! Allowed character set ! Reserved characters ! Reserved words ! Maximum length (characters) ! Comments |- ! {{rh}} | [[8-bit FAT]] | {{dunno}} | {{dunno}} | 7-bit<!-- at least officially --> [[ASCII]] (but stored as bytes) | first character not allowed to be 0x00 or 0xFF<!-- possibly more restrictions based on BASIC syntax, but not known --> | | 9 | align=left| Maximum 9 character base name limit for sequential files (without extension), or maximum 6 and 3 character extension for binary files; see ''[[6.3 filename]]'' |- ! {{rh}} | [[FAT12]], [[FAT16]], [[FAT32]] | {{No}} | {{No}} | any [[SBCS]]/[[double-byte character set|DBCS]] [[OEM codepage]] | <syntaxhighlight lang="text" inline>0x00–0x1F 0x7F " * / : < > ? \ | + , . ; = [ ]</syntaxhighlight> (in some environments also: <syntaxhighlight lang="text" inline>! @</syntaxhighlight>; DOS 1/2 did not allow 0xE5 as first character) | '''Device names including:''' <code>$IDLE$ AUX COM1...COM4 CON CONFIG$ CLOCK$ KEYBD$ LPT1...LPT4 LST NUL PRN SCREEN$</code> (depending on <code>[[AVAILDEV]]</code> status everywhere or only in virtual <code>\DEV\</code> directory) | 11 | align=left| Maximum 8 character base name limit and 3 character extension; see ''[[8.3 filename]]'' |- ! {{rh}} | [[VFAT]] | {{No}} | {{Yes}} | [[Unicode]], using [[UCS-2]] encoding | <syntaxhighlight lang="text" inline>0x00–0x1F 0x7F " * / : < > ? \ |</syntaxhighlight> | | 255 | align=left| |- ! {{rh}} | [[exFAT]] | {{No}} | {{Yes}} | [[Unicode]], using [[UTF-16]] encoding | <syntaxhighlight lang="text" inline>0x00–0x1F 0x7F " * / : < > ? \ |</syntaxhighlight> | | 255 | align=left| |- ! {{rh}} | [[NTFS]] | {{Optional}} | {{Yes}} | [[Unicode]], using [[UTF-16]] encoding | <syntaxhighlight lang="text" inline>0x00–0x1F 0x7F " * / : < > ? \ |</syntaxhighlight> | '''Only in root directory:''' $AttrDef $BadClus $Bitmap $Boot $LogFile $MFT $MFTMirr pagefile.sys $Secure $UpCase $Volume $Extend $Extend\$ObjId $Extend\$Quota $Extend\$Reparse ($Extend is a directory) | 255 | align=left| Paths can be up to 32,000 characters. Forbids the use of characters in range 1–31 (0x01–0x1F) and characters " * / : < > ? \ {{pipe}} unless the name is flagged as being in the Posix namespace. NTFS allows each path component (directory or filename) to be 255 characters long {{Dubious|date=October 2012|reason=http://stackoverflow.com/a/12846728/89771}}. Windows forbids the use of the MS-DOS device names AUX, COM0, ..., COM9, COM¹, ..., COM³, CON, LPT0, ..., LPT9, LPT¹, ..., LPT³, NUL and PRN. These names with an extension (for example, AUX.txt), are allowed but not recommended.<ref>{{Cite web |last=alvinashcraft |date=2024-02-26 |title=Naming Files, Paths, and Namespaces - Win32 apps |url=https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file |access-date=2024-06-11 |website=learn.microsoft.com |language=en-us}}</ref> The Win32 API strips trailing period (full-stop), and leading and trailing space characters from filenames, except when UNC paths are used. These restrictions only apply to Windows; in Linux distributions that support NTFS, filenames are written using NTFS's Posix namespace, which allows any Unicode character except / and NUL. <!-- as said in [[NTFS]] --> |- ! {{rh}} | OS/2 [[High Performance File System|HPFS]] | {{No}} | {{Yes}} | any 8-bit set | {{pipe}}\?*<":>/ | | 254 | align=left| |- ! {{rh}} | Mac OS [[Hierarchical File System (Apple)|HFS]] | {{No}} | {{Yes}} | any 8-bit set | : | | 255 | align=left| old versions of Finder are limited to 31 characters |- ! {{rh}} | [[HFS Plus|HFS+]] | {{Optional}} | {{Yes}} | [[Unicode]], using [[UTF-16]] encoding | : on disk, in classic Mac OS, and at the [[Carbon (API)|Carbon]] layer in macOS; / at the Unix layer in macOS | | 255 | align=left|Mac OS 8.1 - macOS |- ! {{rh}} | [[APFS]] | {{Optional}} | {{Yes}} | [[Unicode]], using [[UTF-8]] encoding<ref>{{cite web |url=https://developer.apple.com/support/apple-file-system/Apple-File-System-Reference.pdf |title=Apple File System Reference |publisher=[[Apple Inc.]]}}</ref> | In the [[Finder (software)|Finder]], filenames containing / can be created, but / is stored as a [[Colon (punctuation)|colon]] (''':''') in the filesystem, and is shown as such on the command line. Filenames containing ''':''' created from the command line are shown with / instead of ''':''' in the Finder, so that it is impossible to create a file that the Finder shows as having a ''':''' in its filename. | | 255 | align=left|[[macOS Sierra]] (10.12.4) and later, [[iOS 10|iOS 10.3]] and later, [[tvOS]] 10.2 and later, [[watchOS]] 3.2 and later, [[iPadOS]] |- ! {{rh}} | most [[UNIX]] file systems | {{Yes}} | {{Yes}} | any 8-bit set | / [[#null|null]] | | 255 | align=left| a leading '''.''' indicates that <code>[[ls]]</code> and file managers will not show the file by default |- ! {{rh}} | [[z/OS]] classic MVS filesystem (datasets) | {{No}} | {{No}} |[[EBCDIC code pages]] |other than $ # @ - x'C0' | |44 | align=left| first character must be alphabetic or national ($, #, @) "Qualified" contains <code>.</code> after every 8 characters or fewer.<ref name="44_char" /> [[Partitioned data set]]s (PDS or PDSE) are divided into members with names of up to 8 characters; the member name is placed in parenthesises after the name of the PDS, e.g. <code>PAYROLL.DEV.CBL(PROG001)</code> |- ! {{rh}} | [[CMS file system]] | {{No}} | {{No}} |[[EBCDIC code pages]] | | |8 + 8 | align=left| Single-level directory structure with disk letters (A–Z). Maximum of 8 character file name with maximum 8 character file type, separated by whitespace. For example, a TEXT file called MEMO on disk A would be accessed as "MEMO TEXT A". (Later versions of VM introduced hierarchical filesystem structures, SFS and BFS, but the original flat directory "minidisk" structure is still widely used.) |- ! {{rh}} | early [[UNIX]] ([[AT&T Corporation]]) | {{Yes}} | {{Yes}} | any 8-bit set | / | | 14 | align=left| a leading '''.''' indicates a "hidden" file |- ! {{rh}} | [[POSIX]] "Fully portable filenames"<ref name="lewine">Lewine, Donald. ''POSIX Programmer's Guide: Writing Portable UNIX Programs'' 1991 O'Reilly & Associates, Inc. Sebastopol, CA pp63–64</ref> | {{Yes}} | {{Yes}} | <code>A–Z a–z 0–9 . _ -</code> | / null | | 14 | align=left| hyphen must not be first character. A command line utility checking for conformance, "pathchk", is part of the IEEE 1003.1 standard and of [[The Open Group]] Base Specifications<ref>[https://pubs.opengroup.org/onlinepubs/9699919799.2016edition/utilities/pathchk.html pathchk - check pathnames]</ref> |- ! {{rh}} | [[ISO 9660]] | {{No}} | {{dunno}} | A–Z 0–9 _ . | | | "close to 180"(Level 2) or 200(Level 3) | align=left| Used on CDs; 8 directory levels max (for Level 1, not level 2,3) |- ! {{rh}} | [[Amiga Old File System|Amiga OFS]] | {{No}} | {{Yes}} | any 8-bit set | : / null | | 30 | align=left| Original File System 1985 |- ! {{rh}} | [[Amiga Fast File System|Amiga FFS]] | {{No}} | {{Yes}} | any 8-bit set | : / null | | 30 | align=left| Fast File System 1988 |- ! {{rh}} | [[Professional File System|Amiga PFS]] | {{No}} | {{Yes}} | any 8-bit set | : / null | | 107 | align=left| Professional File System 1993 |- ! {{rh}} | [[Smart File System|Amiga SFS]] | {{No}} | {{Yes}} | any 8-bit set | : / null | | 107 | align=left| Smart File System 1998 |- ! {{rh}} | Amiga FFS2 | {{No}} | {{Yes}} | any 8-bit set | : / null | | 107 | align=left| Fast File System 2 2002 |- ! {{rh}} | BeOS [[Be File System|BFS]] | {{Yes}} | {{Yes}} | [[Unicode]], using [[UTF-8]] encoding | / | | 255 | align=left| |- ! {{rh}} | DEC [[PDP-11]] [[RT-11]] | {{No}} | {{No}} | [[RADIX-50]] | | | 6 + 3 | align=left| Flat filesystem with no subdirs. A full "file specification" includes device, filename and extension (file type) in the format: dev:filnam.ext. |- ! {{rh}} | DEC [[VAX]] [[OpenVMS|VMS]] | {{No}} | From<br />v7.2 | <code>A–Z 0–9 $ - _</code> | | | 32 per component; earlier 9 per component; latterly, 255 for a filename and 32 for an extension. | align=left| a full "file specification" includes nodename, diskname, directory/ies, filename, extension and version in the format: <code>OURNODE::MYDISK:[THISDIR.THATDIR]FILENAME.EXTENSION;2</code> Directories can only go 8 levels deep. |- ! {{rh}} | [[Commodore DOS]] | {{Yes}} | {{Yes}} | any 8-bit set | :, = | $ | 16 | align=left| length depends on the drive, usually 16 |- ! {{rh}} | [[HP 250]] | {{Yes}} | {{Yes}} | any 8-bit set | <code>SPACE ", : NULL CHR$(255)</code> | | 6 | align=left| Disks and tape drives are addressed either using a label (up to 8 characters) or a unit specification. The HP 250 file system does not use directories, nor does it use extensions to indicate file type. Instead the type is an attribute (e.g. DATA, PROG, BKUP or SYST for data files, program files, backups and the OS itself).<ref>Hewlett-Packard Company Roseville, CA ''HP 250 Syntax Reference'' Rev 1/84 Manual Part no 45260-90063</ref> |} ==See also== * [[File system]] * [[Fully qualified file name]] * [[Long filename]] * [[Path (computing)]] * [[Slug (Web publishing)]] * [[Symbolic link]] * [[Uniform Resource Identifier]] (URI) * [[Uniform Resource Locator]] (URL) and [[Internationalized resource identifier]] *[https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#file-and-directory-names Windows (Win32) File Naming Conventions (Filesystem Agnostic)] ==References== <references/> == External links == {{Wiktionary|filename|filenames}} * [http://www.file-extensions.org/ File Extension Library] * [http://filext.com/ FILExt] * [http://wikiext.com/ WikiExt - File Extensions Encyclopedia] * {{cite web |url=https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file |title=Naming Files, Paths, and Namespaces |website=[[Microsoft Docs]]|date=December 15, 2022 }} * [http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_276 2009 POSIX portable filename character set] * [http://www.ecma-international.org/publications/standards/Ecma-208.htm Standard ECMA-208, December 1994, System-Independent Data Format] * {{citation |url= http://library.stanford.edu/research/data-management-services/data-best-practices/best-practices-file-naming |title=Best Practices for File Naming |publisher=[[Stanford University Libraries]], Data Management Services |location=USA |archive-url=https://web.archive.org/web/20210730125924/http://library.stanford.edu/research/data-management-services/data-best-practices/best-practices-file-naming |archive-date=2021-07-30 |url-status=dead}} {{Computer files}} [[Category:Filenames]] [[Category:Records management]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Anchor
(
edit
)
Template:Char
(
edit
)
Template:Citation
(
edit
)
Template:Citation needed
(
edit
)
Template:Cite IETF
(
edit
)
Template:Cite book
(
edit
)
Template:Cite web
(
edit
)
Template:Clarify
(
edit
)
Template:Code
(
edit
)
Template:Computer files
(
edit
)
Template:Dubious
(
edit
)
Template:Dunno
(
edit
)
Template:Fix
(
edit
)
Template:IETF RFC
(
edit
)
Template:Main
(
edit
)
Template:Main article
(
edit
)
Template:No
(
edit
)
Template:Not verified in body
(
edit
)
Template:Optional
(
edit
)
Template:Pipe
(
edit
)
Template:Redirect
(
edit
)
Template:Rh
(
edit
)
Template:Short description
(
edit
)
Template:Sister project
(
edit
)
Template:Use mdy dates
(
edit
)
Template:Wiktionary
(
edit
)
Template:Yes
(
edit
)