Jump to content

CPGuide - File Names: Difference between revisions

From EDM2
Created page with "File names are the identifiers used by the file system to uniquely identify files on a disk. All file systems have specific rules for constructing names of file objects. Diffe..."
 
No edit summary
Line 1: Line 1:
{{IBM-Reprint}}
{{CPGuide}}
File names are the identifiers used by the file system to uniquely identify files on a disk. All file systems have specific rules for constructing names of file objects. Different file systems can have different rules for naming file objects.  
File names are the identifiers used by the file system to uniquely identify files on a disk. All file systems have specific rules for constructing names of file objects. Different file systems can have different rules for naming file objects.  



Revision as of 19:11, 26 March 2020

Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation

Control Program Programming Guide and Reference
  1. Introduction to the Control Program
  2. Control Program Functions
  3. Keyboard Functions
  4. Mouse Functions
  5. Video Functions
  6. Data Types
  7. Errors
  8. Debugging
  9. Kernel Debugger Communications Protocol
  10. Device I/O
  11. Dynamic Linking
  12. Error Management
  13. Exception Management
  14. Extended Attributes
  15. File Management
  16. File Names
  17. File Systems
  18. Generic IOCtl Commands
  19. Memory Management
  20. Message Management
  21. National Language Support
  22. Pipes
  23. Program Execution Control
  24. Queues
  25. Semaphores
  26. Timers
  27. Notices
  28. Glossary

File names are the identifiers used by the file system to uniquely identify files on a disk. All file systems have specific rules for constructing names of file objects. Different file systems can have different rules for naming file objects.

The OS/2 FAT file system supports the DOS naming conventions. The OS/2 High Performance File System (HPFS) supports a superset of the DOS naming conventions, allowing for long file names and characters illegal under DOS. Although different file systems can have different rules for naming file objects, all OS/2 file systems require that full path names consist of directory and file names separated by backslashes (\).

The OS/2 operating system views path names as ASCII strings and does not restrict file systems to the DOS file name format. Compatibility with existing DOS applications requires that all installable file systems support a superset of the 8.3 file name format used in the FAT file system.

The following topics are related to the information in this chapter:

  • File Systems
  • File Management
  • Extended Attributes
  • Device I/O

File-Naming Conventions

File name conventions are the rules used to form file names in a given file system. Although each installable file system (IFS) can have specific rules about how individual components in a directory or file name are formed, all file systems follow the same general conventions for combining components. For example, although the FAT file system requires that file and directory names have the 8.3 file name format, and HPFS supports names of up to 255 characters long, both file systems use the backslash (\) character to separate directory names and the file name when forming a path.

When creating names for directories and files, or when processing names supplied by the user, an application must follow these general rules:

  • Process a path as a NULL-terminated string. An application can determine maximum length for a path by using DosQuerySysInfo.
  • Use any character in the current code page for a name, but do not use a path separator, a character in the range 0 through 31, or any character explicitly prohibited by the file system.
The following characters are reserved by the operating system. Do not use them in directory or file names.
   <   >   :   "   /   \   |


Although a name can contain characters in the extended character set (128 - 255), an application must be able to switch code pages if necessary to access the corresponding file.
  • Compare names without regard to case. Names such as "ABC", "Abc", and "abc" are considered to be the same.
  • Use the backslash (\) or the forward slash (/) to separate components in a path. No other character is accepted as a path separator.
  • Use the dot (.) as a directory component in a path to represent the current directory.
  • Use two dots (..) as a directory component in a path to represent the parent of the current directory.
  • Use a period (.) to separate components in a directory name or file name. Unless explicitly defined by a file system, no restrictions are placed on the number of components in a name.

File Names in the FAT File System

File Names in the High Performance File System

Long File Names

Moving Files with Long Names

Metacharacters in File Names

Searching for Files Using Metacharacters

Editing File Names Using Metacharacters

Transforming File Names Using Metacharacters

File Names in User Input

Device Names