Filenames

Whether you are writing a file or reading one written by another user, you need to be aware of the differences among filenames on various platforms.

Filename Structure

By number of installed machines, the three most popular platforms at the time of this writing are MS-DOS, Macintosh, and UNIX, roughly in the ratio of 100:10:5. All three support the name.extension filenaming convention (although this is mostly true of the MS-DOS and UNIX systems). Applications occasionally use the extension portion of the filename for file type identification.

Other systems with a large installed user base (such as OS/2, Amiga, Atari, and VMS) have roughly similar naming conventions. VMS, for instance, uses as a default the format:

name1.name2;version

where version is an integer denoting the revision number of the file. In any case, files are likely to come from anywhere, and examination of the extension portion of a filename, if present, may help you to identify the format.

Filename Length

UNIX and Macintosh users are accustomed to long filenames:

ThisIsAMacFilename
This is also a Mac Filename
This.Is.A.Unix.Filename

The MS-DOS, Windows NT, and OS/2 FAT filesystems, on the other hand, limit filenames to the 8.3 format (eight characters per filename, three per extension):

msdosnam.ext

For interplatform portability, we suggest that you consider using the 8.3 convention. Be aware, if you are using MS-DOS, that you may get filename duplication errors when you convert multiple files from other platforms. Depending on the application doing the filename conversion, the following files from a typical UNIX installation:

thisis.file.number.1
thisis.file.number.2

are both converted to the following filename under MS-DOS, and the second file will overwrite the first:

thisis.fil

Case Sensitivity

Users on Macintosh and UNIX systems are accustomed to the fact that filenames are case-sensitive, and that filenames can contain mixed uppercase and lowercase. Filenames on MS-DOS systems, however, are case-insensitive, and the filesystem effectively converts all names to uppercase before manipulating them. Thus:

AMacFile.Ext
AUnixFile.Ext

become:

AMACFILE.EXT
AUNIXFIL.EXT

under MS-DOS and other similar filesystems.

Similarly:

Afile.Ext
AFile.Ext

are both converted to:

AFILE.EXT



Copyright © 1996, 1994 O'Reilly & Associates, Inc. All Rights Reserved.