- Worldstart's Tech Tips And Computer Help - http://www.worldstart.com -

DOS File Name Structure

Posted By On September 1, 2006 @ 3:17 PM In Computer Terms | Comments Disabled

You may know that DOS files are stored in directories or subdirectories. Well, in today’s Windows world, directories are called folders and when talking about DOS, specific rules apply to creating and naming those 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. The following table displays a list of common DOS Windows file extensions with their associations.

Now, let us 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.

Long File Names (LFNS)

Windows 9x, 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 9x 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.

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 9x, 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 9x:

1) Right click the Start button.
2) Left click Explore.
3) Then left click View (located on the top menu bar).
4) Left click Folder Options, then left click View.
5) Under the Files and Folders/Hidden Files section, left click “Show all files.”
6) Then left click Apply and left click OK.
7) 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 below. 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.

The above screenshot is the Windows 9x 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.

Hope the above information helps in understanding the DOS File Name Structure a little better.

~ Nagarajan


Article printed from Worldstart's Tech Tips And Computer Help: http://www.worldstart.com

URL to article: http://www.worldstart.com/dos-file-name-structure/