| advertise add site services publishers database health videos | ![]() | about toolbar stats live show health store more stuff JOIN/LOGIN |
Screenshot of a Windows command shell showing filenames in a directory A filename is metadata about a file; a special kind of string used to uniquely identify a file stored on the file system of a computer. Some operating systems also identify directories in the same way. Different operating systems impose different restrictions on length and allowed characters on filenames. A filename includes one or more of these components:
To refer to a file on a remote computer (aka: host, server), the remote computer must be known. The remote computer name or address might be part of the file name, or it might be specified at the time a file system is "mounted", in which case it won't necessarily be part of the file name. In some systems, if a filename does not contain a path part, the file is assumed to be in the current working directory. Many operating systems, including MS-DOS, Microsoft Windows, and VMS systems, allow a filename extension that consists of one or more characters following the last period in the filename, thus dividing the filename into two parts: the basename (the primary filename) and the extension (usually indicating the file type associated with a certain file format). On these systems the extension is considered part of the filename, and on systems which allow (for example) an eight character basename followed by a three character extension, a filename with an extension of "" or " " (nothing, or three spaces) will still be 11 characters long (since the "." is supplied, but not considered as part of the name, by the OS). On Unix-like systems, files will often have an extension (for example prog.c, denoting the C-language source code of a program called "prog"); but since the extension is not considered a separate part of the filename, a file on a Unix system which allows 14-character filenames, and with a filename which uses "." as an "extension separator" or "delimiter", could possibly have a filename such as a.longxtension Within a single directory, filenames must be unique. Since filename also applies for subdirectories, it is also not possible to create equally named file and subdirectory entries in a single directory. However, two files in different directories may have the same name. In some operating systems, such as MS-DOS, Microsoft Windows, and classic Mac OS, upper-case letters and lower-case letters in file names are considered the same, so that, for example, the file names "MyName" and "myname" would be considered the same, and a directory could not contain a file with the name "MyName" and another file with the name "myname". The file systems in those operating systems are called "case-insensitive". In most file systems in Unix-like systems, however, upper-case and lower-case are considered different, so that files MyName and myname would be valid names for different files concurrently in the same directory. Those file systems are called "case-sensitive". Not all file systems in Unix-like systems are case-sensitive; by default, HFS+ in Mac OS X is case-insensitive, and SMB servers usually provide case-insensitive behavior (even when the underlying file system is case-sensitive, for example Samba on most Unix-like systems), so SMB client file systems provide case-insensitive behavior. File system case sensitivity is a considerable challenge for software such as Samba and Wine, which must interoperate efficiently with both systems that treat uppercase and lowercase files as different and systems that treat them the same.[1] Unix-like systems allow a file to have more than one name; in traditional Unix-style file systems, the names are hard links to the file's inode or equivalent. Hard links are different from Windows shortcuts, Mac OS aliases, or symbolic links.
[edit] Reserved characters and wordsMany 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:
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:
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 .[3] 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.[3] 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. [edit] Comparison of file name limitationsMain article: Comparison of file systems
[edit] Example of a UNIX, Windows and Macintosh Compatible FilenameIf 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. [edit] See also
[edit] References
[edit] External links
|
| ↑ top of page ↑ | about thumbshots |