DOS File Name Structure

 < Day Day Up > 



DOS files are stored in directories or subdirectories. In today’s Windows world, directories are called folders. In DOS, specific rules apply to creating and naming files and directories.

DOS uses what is called an 8.3 file-naming structure, otherwise known as eight dot three. This simply means that a file name can be up to eight characters long and have a three-character extension representing the file type. A period is used to separate the file name from the extension. The total length of the DOS file name plus the extension cannot exceed 11 characters. The file extension is not necessary unless the file is associated with a particular function. Table 10.1 displays a list of common DOS Windows file extensions with their associations.

Let’s use the DOS file name AUTOEXEC.BAT as an example. The AUTOEXEC segment is the DOS file name. The .BAT extension specifies that the file is a batch file. The same is true for the CONFIG.SYS file. CONFIG is the name of the file, and the .SYS extension identifies the file as a system file.

Following are rules that apply to DOS file and directory name creation.

  • A file or directory name can be no more than eight characters long.

  • An extension can be no more than three characters long.

  • No spaces can be included in the file name, the extension, or the directory name.

  • Certain characters (? * , ; = + < > | [ ] / \) are illegal and cannot be used.

    Table 10.1: DOS/Windows Common File Extensions

    File Extension

    Association

    .BAK

    DOS backup file

    .BAT

    DOS file housing a sequence of commands

    .BMP

    Windows bit-mapped graphics file

    .CAB

    Windows 9.x cabinet file

    .COM

    DOS command program file

    .DLL

    Windows dynamic link library file

    .DOC

    Text document file (usually Microsoft Word)

    .EXE

    DOS executable program

    .GRP

    Windows 3.x program group file

    .HTM

    Hypertext markup language file

    .ICO

    Windows 3.x icon file

    .INI

    DOS Windows initialization file

    .SYS

    DOS system driver/hardware configuration file

    .TMP

    Temporary file

    .TXT

    Text file created by DOS or the Windows text editor

    .VXD

    Virtual device driver file

Long File Names (LFNs)

Windows 9.x/NT/2000/Me and Windows XP support long file names (LFNs). LFNs can be up to 255 characters in length. Although these newer operating systems support LFNs, they still allow for backward compatibility with the 8.3 naming structure associated with DOS by creating an associated 8.3 file name for every new file created. LFNs are broken into 12-byte sections that allow the use of up to 255 characters, as in the following:

LFN = BEST CERTIFICATIONBOOK.DOC 8.3 associated file name = BESTCE~1.DOC

Notice that the space after BEST is eliminated in the 8.3 associated file name. Windows automatically removes any spaces or invalid characters and truncates the file name.

It is important to note that the Windows 9.x root directory (C:\) can hold only 255 files. The truncation of LFNs to 8.3 names can quickly fill up this 255-file storage limitation and cause your system to halt. For this reason and others, it is good practice to avoid storing files in the root directory of any operating system.

The following PC Guide Web site has a great page that describes LFNs: http://www.pcguide.com/ref/hdd/file/fatLong-c.html

File Attributes

System files in DOS and Windows, such as IO.SYS and MSDOS.SYS, are hidden, read-only system files. This means that they cannot be viewed or deleted unless their file attributes are modified. Four major attributes can be assigned to DOS and Windows files: R (read-only), A (archive), H (hidden), and S (system).

In DOS, the ATTRIB command can be used to modify the attributes of a file at the command line. For example, to change the attributes for the system file MSDOS.SYS from a read-only/hidden file, enter the following command at a DOS prompt:

C:\ATTRIB –R –H MSDOS.SYS

This command removes the read-only and hidden attributes associated with the file. You will then be able to read and delete the file. Please don’t delete MSDOS.SYS until you are certified. You can add the attributes back to MSDOS.SYS by issuing the following command at the DOS prompt:

C:\ATTRIB +R +H MSDOS.SYS

In Windows 9.x/Me/NT/2000 and Windows XP, the attributes of a file can be viewed and changed (if the currently logged on user has permissions to do so) by simply right-clicking a file in Windows Explorer and either checking or unchecking the appropriate file attribute.

To locate the file MSDOS.SYS in Windows 9.x, right-click the Start button. Left-click Explore, then left-click View (located on the top menu bar). Left-click Folder Options, then left-click View. Under the Files and Folders/Hidden Files section, left-click “Show all files,” then left-click Apply and left-click OK. Close the Folder Options window. The MSDOS.SYS file, along with other system files, will now be visible on the right side of screen. Find the MSDOS.SYS file and right-click it. Left-click Properties. You should now see a window similar to the one shown in Figure 10.3. You can remove the selected file attributes by removing the check marks, or you can add desired attributes by adding check marks. Keep in mind that folders as well as files also have attributes.

click to expand
Figure 10.3: Windows 9.x display of file attributes.

Note 

Many important operating system files are hidden with a typical default operating system installation for the protection of the average user. You should always remember to “Show all files” or “Show hidden files and folders” under Folder Options before troubleshooting.



 < Day Day Up > 



A+ Complete Study Guide, Third Edition (220-301 and 220-302)
The A+ Exams Guide: (Exam 220-301), (Exam 220-302) (TestTakers Guides)
ISBN: 1584503076
EAN: 2147483647
Year: 2003
Pages: 237

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net