Section 2.8. Files, Folders, and Disks


2.8. Files, Folders, and Disks

Files are the basic unit of long- term storage on a computer. Files are organized into folders, which are stored on disks. (In DOS, Unix, and earlier versions of Windows , folders were more often referred to as directories , but both terms are still used.) This section reviews fundamental filesystem concepts, including file- and disk-naming conventions and file types.

2.8.1. Disk Names

Like every version of Windows that preceded it, Windows XP retains the basic DOS disk-naming conventions. Drives are differentiated by a single letter of the alphabet followed by a colon :


A:

Represents the first "floppy" (usually 3.5-inch) disk drive on the system


B:

Represents the second floppy disk drive, if present


C:

Represents the first hard disk drive or the first partition of the first hard disk drive


D:

Often represents a CD-ROM drive, but can represent an additional hard disk drive or other removable drive


E: - Z:

Represent additional hard disk drives, removable cartridges such as Zip or Jaz drives, or mapped network drives

By default, driver letters are assigned consecutively, but it's possible to change the drive letters for most drives so that you can have a drive N : without having a drive M :.

2.8.2. Pathnames

Folders , which contain files, are stored hierarchically on a disk and can be nested to any arbitrary level.

The filesystem on any disk begins with the root (top-level) directory, represented as a backslash. Thus C:\ represents the root directory on the C : drive. Each additional nested directory is simply listed after its "parent," with backslashes used to separate each one. c:\Windows\System\ Color means that the Color folder is in the System folder in the Windows folder on the C: drive. Thus, a path to any given folder can be expressed as a single string of folder names.

A path can be absolute (always starting with a drive letter) or relative (referenced with respect to the current directory). The concept of a current directory is somewhat obsolete in Windows XP, with the exception of commands issued from the command prompt. Each command prompt window has an active folder associated with it, to which each command is directed. For example, if the current directory is c:\windows , and you were to type DIR (the directory listing command), you would get a listing of the files in that folder. If you were to then type CD cursors , the current directory would then become c:\windows\cursors .

The fact that the entire, absolute path was not needed after the CD command is an example of the use of a relative path.

A special type of relative path is made up of one or more dots. The names . and . . refer to the current directory and the parent of that directory, respectively ( c:\windows is the parent folder of c:\windows\cursors , for example). Type CD . . while in c:\windows , and the current directory becomes simply C:\ . Use of additional dots (such as .. .) used in some previous versions of Windows is not supported in Windows XP. The graphical equivalent of . . is the yellow folder icon with the curved arrow, found in common file dialogs.

The left pane in Windows Explorer (by default) contains a hierarchical tree-structured view of the filesystem. The tree structure makes it easier to navigate through all the folders on your system, since it provides a graphical overview of the structure. See Chapter 3 for more information on the tree and Chapter 4 for more information on the Explorer application.

2.8.3. Paths to Network Resources

Files on any shared network can be referred to via a Universal Naming Convention (UNC) pathname, which is very similar to a path (described in the previous section). The first element of a UNC pathname is the name of the computer or device that contains the file, prefixed by a double backslash. The second element is the device's share name . What follows is the string of folders leading to the target folder or file.

For example, the UNC path \ \shoebox\o\hemp\adriana.txt refers to a file named adrianna.txt , located in the hemp folder, located on drive O: , located on a computer named shoebox . For more information on UNC pathnames and sharing resources on a network, see Chapter 7.

2.8.4. Short Names and Long Names

DOS and Windows 3.1, the Microsoft operating systems that preceeded Windows 95 and Windows NT, only supported filenames with a maximum of eight characters , plus a three-character file type extension (e.g., myfile.txt ). The maximum length of any path was 80 characters (see "Pathnames," earlier in this chapter, for more information on paths). Legal characters included any combination of letters and numbers , extended ASCII characters with values greater than 127, and the following punctuation characters:

 $ % ^ ' ` - _ @ ~ ! ( ) # & 

Spaces were not allowed.

Windows XP supports long filenames (up to 260 characters), which can include spaces as well as the additional punctuation characters:

 $ % ^ ' ` - _ @ ~ ! ( ) # & + , ; = [ ] . 

For example, a file could be named Picture of my Niece.jpg , and could be located in a folder named Family Photos . Furthermore, extensions are no longer limited to 3 characters; for example, .html is perfectly valid (and distinctly different from . htm ). For more information on file types and extensions, see the discussion in the next section, and in Appendix F.

The maximum length of any path in Windows XP depends on the filesystem you're using (NTFS, FAT32, etc.). For more information on filesystems, see Appendix A.

Windows XP's filesystem is case preserving , but also case insensitive. For example, the case of a file named FooBar.txt will be preserved with the capital F and B, but if you were to type FOObar in a file open dialog box, Windows would recognize it as the same file.

Long filenames are compatible with all modern versions of Windows, but to maintain compatibilty with DOS programs and applications written for Windows 3.x, Windows XP maintains a short counterpart to every long filename. The short name consists of the first six letters of the long name, a tilde, a number from 1 to 9 (the number is incremented to prevent two long filenames being linked to the same short filename; after ~9, those six characters are reduced to five), and the file type extension, if any. (If an extension is longer than three characters, only the first three characters appear.) Any spaces in the first six characters are removed.

The easiest way to investigate short filenames is to use the command prompt (see Chapter 6 for details). If, for example, you had a file named Adrianna.html and you typed DIR adrian~1.htm , you'd have a match. The same rules apply to folder names: \Program Files becomes \PROGRA~1 . For the most part, these short filenames are of little importance if you only use applications that are long filename-aware, but they may come up, for instance, if you share files with a user of an older computer.

2.8.5. File Types and Extensions

Most files have a filename extension, the (usually three) letters that appear after the last dot in any file's name. Here are some common file extensions:


.xls

An Excel spreadsheet


.txt

A text file ( to be opened with Notepad)


.html

A hypertext markup language file, commonly known as a web page


.jpg

A JPEG image file, used to store photos

Although each of these files hold very different types of data, the only way Windows differentiates them is by their filename extension. How Windows is able to determine a given file's type is important for several reasons, especially because it is the basis for the associations that link documents with the applications that created them. For example, when you double-click on a file named donkey.html , Windows looks up the extension in the Registry (see Chapter 8), and then, by default, opens the file in your web browser. Rename the file to donkey.jpg , and the association changes as well. (The exception to this is a special, invisible link shared only by Microsoft Office documents. If you rename an Office 2000 document (say, donkey.doc to donkey.stubborn ) and double-click it, Windows will still open it in Word. Unfortunately , this mechanism is not available for any non-Office file types.)

The lesson here is that filename extensions are not a reliable guide to a file's type, despite how heavily Windows XP relies on them. What can make it even more frustrating is that known filename extensions are hidden by Windows XP by default, but unfamiliar extensions are shown. Rename donkey.xyz (a unassociated extension) to donkey.txt , and the extension simply disappears in Explorer. Or, try to differentiate donkey.txt from donkey.doc when the extensions are hidden. To instruct Windows to show all extensions, go to Control Panel Folder Options View, and turn off the "Hide file extensions for known file types" option.

To see all the configured file extensions on your system, go to Control Panel Folder Options File Types. More information on file types can be found in Chapter 4. Appendix F contains a list of common filename extensions and their descriptions.

2.8.6. Views Through Folder Windows

Double-click on a folder icon, and you'll see the contents of the folder. Look at the status bar (turn it on with the View menu if it's absent) for summary information, such as the number of items in the folder, the total size of the contents, and the amount of free disk space.

Depending on your settings, the icons may be shown in any of five different formats: Thumbnails, Tiles, Icons, List, or Details. If you're looking at a folder full of images, the Thumbnails settings (in the View menu) might be useful. The Icons setting resembles the way files and folders are shown on the Desktop, but the Details view shows the most information. To customize the columns in the Details view, use View Choose Details. Figure 2-8 shows the Details view of a folder.

Figure 2-8. Sort folder listings by clicking on column headers or change column widths by dragging boundaries between the headers

Windows XP will remember the view setting for each folder by default and will display it the same way the next time the folder is opened. (If a long time passes before you open a folder again, Windows will forget its settings.) You can turn this setting off by going to Control Panel Folder Options View Remember each folder's view settings.

In addition to the icon styles, three other elements are of interest in Folder Windows: the Explorer Bar, the Web View, and the Explorer toolbar.

The first is the Explorer Bar, which usually contains the folder tree (called simply Folders). If you press Ctrl-F or F3, the folder tree disappears and a search box is put in its place. Use View Explorer Bar to access the other things that can appear in that pane, or to hide it entirely. Note that the window icon changes to reflect the Explorer Bar setting, implying that the primary function of the window has changed. If you don't want the current state of the window to change, say, when you want to search for a file, you'll have to open a new folder window and search from there.

The second element is what is commonly known as the Web View, and in Windows XP, is more specifically known as Web Content in Folders. The Web View, first introduced in Windows 98, is intended to provide more information than is normally available in a bare folder window. Microsoft has changed the appearance and contents of the Web View in each successive release of Windows, although it has never proven to be especially useful. (For example, it provides little information that isn't already available in the Details view.) Unfortunately, the Web View in Windows XP is no different.

The "Common Tasks " feature replaces the Web View pane found in earlier versions of Windows, and can be turned on or off by going to Control Panel Folder Options and selecting the "Show common tasks in folders" or "Use Windows classic folders" options, respectively. If the Common Tasks pane is visible, you can collapse and expand the boxes by clicking on the little arrows. Unlike the earlier Web View pane, however, the Common Tasks pane is not customizable. Although there is a Customize this Folder option in the Explorer View menu, it's only used for changing the icon of the currently selected folder.

The third element is the Toolbar. The Explorer Toolbar, like toolbars in most applications, provides quick access to some of the more frequently used features, all of which are otherwise accessible through the menus and with keyboard accelerators. Enable, disable, and customize the toolbar View Toolbar. One of the components in the Toolbar, the Address Bar, is most useful with Internet Explorer, but can be of some use in ordinary folder windows. For example, you can type the path to a folder, press Enter, and the folder's contents will be shown in the current window. This can often be faster than navigating with the folder tree or using several consecutive folder windows. See Chapter 3 for details on using the Address Bar. Figure 2-9 shows the buttons on the Toolbar for a folder.

Figure 2-9. The Toolbar provides quick access to frequently used functions; the Status Bar shows additional information about selected icons

Although each new folder window you open will appear with Microsoft's default settings, it's possible to modify those defaults. Start by configuring a folder according to your preferences: choose the icon size, the sort order, etc. Then, go to Tools Folder Options View, and click Apply to All Folders. The setting will then be used for each new single folder window that is opened.

If you click Windows Explorer in the Start menu, you'll get a folder window with the folder tree shown in the left pane (as opposed to a folder window opened by double-clicking on a folder icon). This window is commonly referred to simply as Explorer, and although the right pane looks just like a single folder window without the tree pane, Windows XP treats them slightly differently. For example, if you use the Like Current Folder button in a single folder window, as described above, Windows will use your preferences for all single folder windows, but not for Explorer. Likewise, saved settings in Explorer aren't reflected in single folder windows. Because of this, you may feel like you have to jump through several hoops in order to set your preferences in all the windows you use; unfortunately, there's no easier way.


2.8.7. Keyboard Accelerators in Folder Windows

Some keyboard accelerators are especially useful in Explorer and folder windows. These are used in addition to the various keys described in Section 2.2, earlier in this chapter.

  • Hold the Alt key while double-clicking on a file or folder to view the Properties window for that object.

  • Hold the Shift key while double-clicking on a folder to open an Explorer window (with the tree view) at that location. (Be careful when using this because Shift is also used to select multiple files. The best way is to select the file first.)

  • Press Backspace in an open folder to go to the parent (containing) folder.

  • Hold Alt while pressing the left cursor key to navigate to the previously viewed folder. Note that this is not necessarily the parent folder, but rather the last folder opened in Explorer. You can also hold Alt while pressing the right cursor key to move in the opposite direction (i.e., forward); this is similar to the Back and Next buttons in Internet Explorer, respectively. The Windows Explorer toolbar also has Back and Next buttons.

  • Hold the Shift key while clicking on the close button (the x in the upper right corner of the window on the menu bar) to close all open folders that were used to get to that folder. (This, of course, makes sense only in the single-folder view and with the "Open each folder in its own window" option turned on.)

  • Press Ctrl-A to quickly select all contents of a folder: both files and folders.

  • In Explorer or any single-folder window, press a letter key to quickly jump to the first file or folder starting with that letter. Continue typing to jump further. For example, pressing the N key in your \Windows folder will jump to NetHood . Press N again to jump to the next object that starts with N. Or, press N and then quickly press O to skip all the Ns and jump to notepad.exe . If there's enough of a delay between the N and the O keys, Explorer will forget about the N, and you'll jump to the first entry that starts with O.

2.8.8. Advanced Drag-Drop Techniques

Some of the basics of drag-drop are discussed in Section 2.2, earlier in this chapter, but you can use some advanced techniques to have more control when you're dragging and dropping items. Naturally, it's important to be able to anticipate what will happen when you drag-drop an item before you actually do the dropping. The problem is that drag-drop is handled differently in various situations, so sometimes you'll need to modify your behavior to achieve the desired result. Here are the rules that Windows follows when determining how dropped files are handled:

  • If you drag an object from one place to another on the same physical drive ( c:\docs to c:\ files ), the object is moved.

  • If you drag an object from one physical drive to another physical drive ( c:\docs to d:\ files ), the object is copied , resulting in two identical files on your system.

  • If you drag an object from one physical drive to another physical drive and then back to the first physical drive, but in a different folder ( c:\docs to d:\ files to c:\stuff ), you'll end up with three copies of the object.

  • If you drag an application executable (an EXE file), the same rules apply to it that apply to other objects, with the following exceptions: [2]

    [2] The behavior in Windows XP is the same as in Windows Me and Windows 2000, but a little different from Windows 95, 98, and NT 4: in these releases, dragging an EXE file anywhere created a shortcut.

    • If you drag any file named setup.exe or install.exe from one place to another, Windows will create a shortcut to the file, regardless of the source or destination folder.

    • If you drag any file with the .exe filename extension into any portion of your Start menu or into any subfolder of your Start Menu folder, Windows will create a shortcut to the file. Dragging other file types (documents, script files, or other shortcuts) to the Start menu will simply move or copy them there, according to the previous rules.

  • If you drag a system object (such as an item in the My Computer window or Control Panel) anywhere, a warning is displayed and a shortcut to the item is created. This, of course, is a consequence of the fact that these objects aren't actually files and can't be duplicated or removed from their original locations.

  • If you drag system icons or items that appear within system folders, such as My Documents, Internet Explorer, or the Recycle Bin, any number of different things can happen, each depending on the specific capabilities of the object. For example, if you drag a recently deleted file from the Recycle Bin, it will always be moved, since making a copy of, or a shortcut to, a deleted file makes no sense.

If you have trouble remembering these rules, or if you run into a confusing situation, you can always fall back on the information Windows provides you while you're dragging, in the form of the mouse cursor. A small plus sign (+) appears next to the pointer when copying, and a curved arrow appears when creating a shortcut. If you see no symbol, the object will be moved. This visual feedback is very important; it can eliminate a lot of stupid mistakes if you pay attention to it.

Here's how to control what happens when you drag-drop an item:

  • To copy an object under any situation, hold the Ctrl key while dragging. If you press Ctrl before you click, Windows assumes you're still selecting files, so make sure to press it only after you've started dragging but before you let go of that mouse button. Of course, this won't work for system objects like Control Panel itemsa shortcut will be created regardless. Using the Ctrl key in this way will also work when dragging a file from one part of a folder to another part of the same folder, which is an easy way to duplicate a file or folder.

  • To move an object under any situation, hold the Shift key while dragging. Likewise, if you press Shift before you click, Windows assumes you're still selecting files, so make sure to press it only after you've started dragging but before you let go of that mouse button. This also won't work for system objects like Control Panel itemsa shortcut will be created regardless.

  • To create a shortcut to an object under any situation, hold the Ctrl and Shift keys simultaneously while dragging. If you try to make a shortcut that points to another shortcut, the shortcut will simply be copied (duplicated).

  • To choose what happens to dragged files each time without having to press any keys, drag your files with the right mouse button and a special menu will appear when the files are dropped. This context menu is especially helpful because it will display only options appropriate to the type of object you're dragging and the place where you've dropped it.



Windows XP in a Nutshell
Windows XP in a Nutshell, Second Edition
ISBN: 0596009003
EAN: 2147483647
Year: 2003
Pages: 266

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