A file name has two parts primary name and extension. The primary name and extension are separated by a dot (.). The primary name can have a maximum of 8 characters and the extension can have 3 characters. The file name is valid if it has no extension. File names can comprise of the following characters
Character type | Input character |
An alphabet | (A-Z) |
A numeral | (0-9) |
Other characters | ($, #, &, @, !, %, (), -, _, {}, ‘, ~, ^) |
Though files are given names by the people who create them, file names have to follow the naming conventions. Also, each file in a particular location on a disk needs to have a unique name. Examples of some valid file names are EMPLOYEE.DAT, EXEC.T, XYZ, 123.45, HRD.RPT
For example
To access a file called TRAVEL.EXP from the personal directory, we would have to specify the path as the above
Here,
- Is the drive name.
- is the path (route which DOS has to take to reach the path)
- is the directory under the root directory, beginning from which the file has to be accessed.
- is the subdirectory under the directory mentioned in 3 (3 is the parent directory).
- is the primary name of the file to be accessed.
- is the extension name of the file to be accessed.
This is the complete file reference that indicates that there is a subdirectory Personal under a directory Expense, which is under the root directory, and a subdirectory Personal contains a file named TRAVEL.EXP.
The \(backslash) is a convention that must be followed to enable DOS to trace the path. By specifying the first \, DOS is automatically directed to go to the root directory from any directory. Thus, any path that is stated essentially starts from the root. The subsequent backslashes are to differentiate between the various directories, sub-directories, and the file name that has been specified.