Filename
Reserved characters and words
Many operating systems prohibit control characters from appearing in file names. For example, DOS and early Windows systems require files to follow the 8.3 filename convention. Unix-like systems are an exception, as the only control character forbidden in file names is the null character, as that’s the end-of-string indicator in C. Trivially, Unix also excludes the path separator / from appearing in filenames.
Some operating systems prohibit some particular characters from appearing in file names:
Character
Name
Reason
/
slash
used as a path name component separator in Unix-like, Windows, and Amiga systems. (The MS-DOS command.com shell would consume it as a switch character, but Windows itself always accepts it as a separator)
backslash
Also used as a path name component separator in MS-DOS, OS/2 and Windows (there is no difference between slash and backslash); allowed in Unix filenames, see Note 1
?
question mark
used as a wildcard in Unix, Windows and AmigaOS; marks a single character. Allowed in Unix filenames, see Note 1
%
percent sign
used as a wildcard in RT-11; marks a single character.
*
asterisk
used as a wildcard in Unix, MS-DOS, RT-11, VMS and Windows. Marks any sequence of characters (Unix, Windows, later versions of MS-DOS) or any sequence of characters in either the basename or extension (thus “*.*” in early versions of MS-DOS means “all files”. Allowed in Unix filenames, see note 1
:
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 “\”.)
|
vertical bar
designates software pipelining in Unix and Windows; allowed in Unix filenames, see Note 1
”
quotation mark
used to mark beginning and end of filenames containing spaces in Windows, see Note 1
<
less than
used to redirect input, allowed in Unix filenames, see Note 1
>
greater than
used to redirect output, allowed in Unix filenames, see Note 1
.
period
allowed but the last occurrence will be interpreted to be the extension separator in VMS, MS-DOS and Windows. In other OSes, usually considered as part of the filename, and more than one full stop may be allowed.
Note 1: Most Unix shells require certain characters such as spaces, <, >, |, , and sometimes :, (, ), &, ;, as well as wildcards such as ? and *, to be quoted or escaped:
five and six<seven (example of escaping)
‘five and six<seven’ or “five and six<seven” (examples of quoting)
In Windows the space and the period are not allowed as the final character of a filename. The period is allowed as the first character, but certain Windows applications, such as Windows Explorer, forbid creating or renaming such files (despite this convention being used in Unix-like systems to describe hidden files and directories). Among workarounds are using different explorer applications or saving a file with the desired file name from within an application .
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 imposed by particular file systems.
In Unix-like systems, MS-DOS, and Windows, the file names “.” and “..” have special meanings (current and parent directory respectively).
In addition, in Windows and DOS, some words might also be reserved and can not be used as filenames. For example, DOS Device file:
CON, PRN, AUX, CLOCK$, NUL
COM0, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9
LPT0, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9.
Operating 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, q”uote”s.txt, or NUL.txt.
Comparison of file name limitations
Main article: Comparison of file systems
System
Alphabetic Case Sensitivity
Allowed Character Set
Reserved Characters
Reserved Words
Maximum Length
Comments
MS-DOS FAT
case-insensitive case-destruction
any
0x00-0x1F SPACE DEL ” * / : < > ? |
Devicesnames like: AUX COM1 COM2 COM3 COM4 COM5 COM6 COM7 COM8 COM9 CON LPT1 LPT2 LPT3 LPT4 LPT5 LPT6 LPT7 LPT8 LPT9 NUL PRN
12
Maximum 8 character name limit and 3 character extension; see 8.3 filename
Commodore 64
case-sensitive case-preservation
any
:,=
$
16
Actual limit depends on the drive used, but most drives limit the length to 16 characters.
Win95 VFAT
case-insensitive
any
|?*<“:>+[]/ control characters
255
NTFS
optional (case-preservation)
any (including Unicode characters)
/ null (i.e., 0x00)
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
Microsoft Windows: Windows kernel forbids the use of characters in range 1-31 (i.e., 0x01-0x1F) and characters ” * : < > ? / |. Although NTFS allows each path component (directory or filename) to be 255 characters long and paths up to about 32767 characters long, the Windows kernel only supports paths up to 259 characters long. Additionally, Windows forbids the use of the MS-DOS device names AUX, CLOCK$, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, CON, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9, NUL and PRN, as well as these names with any extension (for example, AUX.txt), except when using Long UNC paths (ex. \.C:
ul.txt or \?D:auxcon). (In fact, CLOCK$ may be used if an extension is provided.) These restrictions only apply to Windows – Linux, for example, allows use of ” * : < > ? / | even in NTFS.
OS/2 HPFS
case-insensitive case-preservation
any
|?*<“:>/
254
Mac OS HFS
case-insensitive case-preservation
any
:
255
old versions of Finder are limited to 31 characters
Mac OS HFS+
optional (case-preservation)
any
: on disk, in classic Mac OS, and at the Carbon layer in Mac OS X; / at the Unix layer in Mac OS X
255
Mac OS 8.1 – Mac OS X
most UNIX file systems
case-sensitive case-preservation
any
/ null
255
a leading . indicates that ls and file managers will not by default show the file
early UNIX (AT&T)
case-sensitive case-preservation
any
/
14
a leading . indicates a “hidden” file
POSIX “Fully portable filenames”
case-sensitive case-preservation
Aa09._-
/ null
Filenames to avoid include: a.out, core, .profile, .history, .cshrc
14
hyphen must not be first character
AmigaOS
case-insensitive case-preservation
any
:/”
107
dos.library
Amiga OFS
case-insensitive case-preservation
any
:/”
30
Original File System 1985
Amiga FFS
case-insensitive case-preservation
any
:/”
30
Fast File System 1988
Amiga PFS
case-insensitive case-preservation
any
:/”
255
Professional File System 1993
Amiga SFS
case-insensitive case-preservation
any
:/”
32,000
Smart File System 1998
Amiga FFS2
case-insensitive case-preservation
any
:/”
107
Fast File System 2 2002
BeOS BFS
case-sensitive
UTF-8
/
255
DEC PDP-11 RT-11
case-insensitive
RADIX-50
6 + 3
Flat filesystem with no subdirs. A full “file specification” includes device, filename and extension (file type) in the format: dev:filnam.ext.
DEC VAX VMS
case-insensitive
A 09 $ – _
32 per component; earlier 9 per component; latterly, 255 for a filename and 32 for an extension.
a full “file specification” includes nodename, diskname, directory/ies, filename, extension and version in the format: OURNODE::MYDISK:[THISDIR.THATDIR]FILENAME.EXTENSION;2 Directories can only go 8 levels deep.
ISO 9660
case-insensitive
A 09 _ .
255
8 directory levels max (for Level 1 conformance)
Example of a UNIX, Windows and Macintosh Compatible Filename
This section may require cleanup to meet Wikipedia’s quality standards. Please improve this section if you can. (December 2009)
If you want a filename that works on your Macintosh or Windows computer and also when uploaded, restrict yourself to these characters: ${}^[]`=,;`abcdefghijklmnopqrstuvwxyz._-0123456789.html
Though the link will work as is, the server actually encodes the above filename as follows.
%24%7B%7D%5E%5B%5D%60%3D%2C%3B%60abcdefghijklmnopqrstuvwxyz._-0123456789.html
You could also use UPPERCASE letters in the filenames, but off of the UNIX server, filenames are case-insensitive.
See also
File system
Long filename
Path (computing)
Symbolic link
Uniform Resource Identifier (URI)
Uniform Resource Locator (URL)
References
^ http://wiki.winehq.org/CaseInsensitiveFilenames
^ http://www.thescripts.com/forum/thread23123.html
^ a b Naming a file msdn.microsoft.com (MSDN), filename restrictions on Windows
^ Lewine, Donald. POSIX Programmer’s Guide: Writing Portable UNIX Programs 1991 O’Reilly & Associates, Inc. Sebastopol, CA pp63-64
External links
File extension resource: FileInfo.com
List of filename extensions: FILExt
Large collection of extensions: DotWhat.net
Large list of filename extensions: File-extensions.org
Metasearch engine for file extensions: File Extension Seeker
Categories: Computer file formats | NamesHidden categories: Articles to be merged from January 2008 | All articles to be merged | Articles needing cleanup from December 2009 | All pages needing cleanup
I am a professional writer from China Toys Suppliers, which contains a great deal of information about smart water meters , amr water meter, welcome to visit!