Working with files and directories

Filenaming conventions

The maximum permitted length of a file or directory name is 255 characters. In fact, this is controlled by the value of the {NAME_MAX} constant; to check the value of this, use the getconf(C) command, as follows:

   $ getconf NAME_MAX .
Pathnames, which are described in ``How directories are organized'', have a maximum permitted length of 1024 characters (as controlled by {PATH_MAX}, which is also controllable using getconf).

An important consideration, where Open Systems are an issue, is filename portability. Many of the international standards specify a character set that should be used for the construction of portable filenames. The IEEE POSIX standard, for example, specifies the following Portable Filename Character Set:

Portable filenames should not begin with a hyphen, although it may appear in any other position. Specifically, the following characters should not be used in file or directory names because they have a special meaning for the UNIX system:

! " ` ' ; / $ < > ( ) | { } [ ] ~

The slash character (/) signifies both the root directory and the pathname element separator, and is valid only in these contexts. See ``How directories are organized'' for more information on pathnames.

Filenames may begin with a dot (.), but this has the effect of excluding them from normal directory listings. See ``Listing the contents of a directory'' for details of how to list these ``hidden'' files.

Next topic: Managing directories
Previous topic: How the system manages files and directories

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003