Managing Files and Directories

Archived content. No warranty is made as to technical accuracy. Content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

By William R. Stanek

Archived content - No warranty is made as to technical accuracy. Content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

from Chapter 9, Windows NT Administrator's Pocket Consultant .

Microsoft Windows NT provides a robust environment for working with files and directories. At the core of this environment are the two basic file system types:

  • FAT (file allocation table)

  • NTFS file system

When you work with files and directories on a Windows NT system you'll usually work with one of these file system types. To help you better administer FAT and NTFS volumes, this chapter explains how to implement common file and directory tasks. It also offers ways of troubleshooting problems.

Windows NT File Structures

This section covers the core information you'll need to work with files. An understanding of file basics can make your job as an administrator a lot easier.

Major Features of FAT and NTFS

What you can or can't do with files and directories in Windows NT depends on the file system type. Windows NT servers and workstations provide direct support for FAT and NTFS.

FAT Volumes

FAT volumes rely on an allocation table to keep track of the status of files and directories. Although FAT is adequate for most file and directory needs, it is rather limited. With FAT

  • You can't control local access to files and directories using Windows NT access permissions.

  • You can't compress files using Windows NT compression.

  • You can use Windows NT file sharing.

  • You have limited control over remote access to files and directories. (You do this with file sharing.)

  • You can use long file names (file and directory names with up to 255 characters).

Using NTFS

On the other hand, NTFS offers a robust environment for working with files and directories. With NTFS

  • You can use Windows NT file access permissions to control local access to files.

  • You can use Windows NT compression.

  • You can use Windows NT file sharing and fully control remote access to files and directories.

  • You can use long file names (file and directory names with up to 255 characters).

File Naming

Windows NT file naming conventions apply to both files and directories. For simplicity, the term "file naming" is often used to refer to both files and directories. Although Windows NT file names are case-aware, they are not case-sensitive. This means you can save a file named MyBook.doc and the file name will be displayed in the correct case. However, you can't save a file called mybook.doc to the same directory.

Both NTFS and FAT support long file names—up to 255 characters. You can name files using just about any of the available characters, including spaces. However, there are some characters you can't use. They include

? * / \ : ; < >

Tip Using spaces in file names can cause access problems. Anytime you reference the file name, you may need to enclose the file name within quotation marks. Also, if you plan to publish the file on the Web, you may need to remove the spaces from the file name or convert them to the underscore character (_) to ensure that Web browsers have easy access to the file.

The following file names are all acceptable:

  • My Favorite Short Story.doc

  • My_Favorite_Short_Story.doc

  • My..Favorite..Short..Story.doc

  • My Favorite Short Story!!!.doc

Accessing Long File Names Under MS-DOS

Under MS-DOS and 16-bit FAT file systems, file and directory names are restricted to eight characters with a three-character file extension, such as CHAPTER4.TXT. This naming convention is often referred to as the 8.3 file-naming rule or the standard MS-DOS file-naming rule. Because of it, when you work with files at the Command prompt you may have problems accessing files and directories.

To support access to long file names, abbreviated file names are created for all files and directories on a system. These file names conform to the standard MS-DOS file-naming rule. You can see the abbreviated file names using the command

dir /X

A typical abbreviated file name looks like this:

PROGRA~1.DOC

How Windows NT Creates an Abbreviated File Name

When Windows NT creates an abbreviated file name from a long file name, the following rules are used:

  • Any spaces in the file name are removed. The file name, My Favorite Short Story.doc, becomes MyFavoriteShortStory.doc.

  • All periods in the file name are removed (with the exception of the period separating the file name from the file extension). The file name, My..Favorite..Short..Story.doc, becomes MyFavoriteShortStory.doc.

  • Invalid characters under the standard MS-DOS naming rule are replaced with the underscore character (_). The file name, My[Favorite]ShortStory.doc, becomes My_Favorite_Short_Story.doc.

  • All remaining characters are converted to uppercase. The file name, My Favorite Short Story.doc, becomes MYFAVORITESHORTSTORY.DOC.

The Rules of Truncation

To make the file conform to the 8.3 naming convention, the file name and file extension are truncated if necessary. The rules for truncation are as follows:

  • The file extension is truncated to the first three characters. The file name Mary.text becomes MARY.TEX.

  • The file name is truncated to the first six characters (this is the file's root name) and a unique designator is appended. The unique designator follows the convention ~n, where n is the number of the file with the six-character file name. Following this, the file name, My Favorite Short Story.doc, becomes MYFAVO~1.DOC. The second file in this directory that is truncated to MYFAVO becomes MYFAVO~2.DOC.

Note: The file name truncation rule described here is the one you'll usually see, and you won't often have to worry about anything else. However, if you have lots of files with similar names, you may see another convention used to create the short file name.

Specifically, if more than four files use the same six-character root, additional file names are created by combining the first two characters of the file name with a four-character hash code and then appending a unique designator. A directory could have files named MYFAVO~1.DOC, MYFAVO~2.DOC, MYFAVO~3.DOC, and MYFAVO~4.DOC. Additional files with this root could be named MY3140~1.DOC, MY40C7~1.DOC, and MYEACC~1.DOC.

Manipulating Files and Directories

Microsoft Windows NT Explorer is the tool of choice for working with files and directories. You can also use My Computer and Network Neighborhood to perform many file manipulation tasks. Access My Computer and Network Neighborhood by double-clicking on their icons on the Windows NT desktop.

Note: For brevity, this section focuses primarily on using Windows NT Explorer. However, you can apply similar techniques to My Computer and Network Neighborhood.

from Windows NT Administrator's Pocket Consultant by William R. Stanek. Copyright © 1999 Microsoft Corporation.

Link
Click to order