2.2 Handling Files and Folders

Much of the work we do on a computer either involves creating or modifying documents. The rest of the time, it seems like all we do is move those documents around. The next few topics will help make file manipulation easier and hopefully a lot more pleasurable.

2.2.1 Take Charge of Drag-Drop

Intuitively, when one drags an object from one place on the screen to another, it would seem reasonable that the object would then appear in the new place and disappear from the old place. In other words, what happens to a file when you drag it from the left side of your desktop to the right side of your desktop should be exactly the same as what happens when you drag a file from one folder to another or from a floppy disk to your hard drive.

The problem is that drag-drop is handled differently in different situations. The decision of what action to take in each situation was made by a committee at Microsoft; I'd be willing to bet that you didn't have a personal representative at that meeting.

So, our aim here is to force Windows to work the way we think, keeping in mind the practical limitations of the operating system. Here's the way Explorer works (note that "object" is a file, folder, shortcut, system object, or anything else with an icon that can be knocked around with your mouse):

  • 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.

    This means that 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 unfortunate exceptions:[3]

    [3] In Windows 95, 98, and NT 4.0, dragging any .exe file anywhere would cause a shortcut to be created. This behavior, which nobody liked, has been mostly, but not entirely, abandoned in Windows XP.

    • 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, other shortcuts) to the Start Menu will simply move or copy them there, according to the previous rules.

    • If these weren't enough, there are further exceptions. If you drag a file named setup.exe into a recordable CD drive, it will be copied. And if you drag a bunch of files of different types (including, say, setup.exe), then the create-a-shortcut rules above will be ignored, and they'll just be copied or moved as appropriate.

  • If you drag a system object (such as a Control Panel icon), a warning is displayed, and a shortcut to the item will be 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 certain icons that appear on the desktop, such as My Documents, Internet Explorer, or the Recycle Bin, any number of different things can happen, each depending on the specific properties of the object.

The best way to cope with this confusion is to use a combination of certain keystrokes and the right mouse button to ensure the desired results every time you drag an object. That way, you don't have to predict what will happen based on some rules you won't likely remember.

  • To copy an object in any situation, hold the Ctrl key while dragging. If you press Ctrl before you click, Windows assumes you're still selecting files (as described earlier in this chapter), 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 items a 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. See Section 2.2.3 later in this chapter for more information.

  • To move an object in 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. Like above, this doesn't apply to system objects like Control Panel icons.

  • To create a shortcut to an object under any situation, hold the Alt key while dragging. Note that this is different than in previous versions of Windows.

  • 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 like the one shown in Figure 2-3 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.

Figure 2-3. Drag files with the right mouse button for more control.

figs/xpan_0203.gif

To aid in learning the keystrokes, notice that the mouse cursor changes depending on the action taken. A small plus sign [+] appears 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.

There is no way to set the default action when dragging files and therefore no way to avoid using keystrokes or the right mouse button to achieve the desired results. Even if there were a way to change the default behavior, you probably wouldn't want to do it. Imagine if someone else sat down at your computer and started dragging icons: oh, the horror.

Explorer's Undo command (in the Edit menu, as well as available by right-clicking in an empty area of Explorer or the desktop) allows you to undo the last few file operations.[4] If you've copied, moved, or renamed one or more objects, the command will read Undo Copy, Undo Move, or Undo Rename, respectively. Additionally, if your Recycle Bin is configured to store files, Undo Delete may also appear. However, if you're doing a lot of copying, moving, and deleting of files, it's hard to know to which particular operation the Undo command refers at any given time. The easiest way to tell is to click and hold the mouse button over the Undo menu item and look in the status bar (select Status Bar from the View menu if it's not visible), which will tell you exactly with which files the operation dealt. This, of course, is not available on the desktop, but luckily, the Undo command works the same regardless of the folder from which you use it.

[4] Ctrl-Z is a keyboard shortcut for Undo.

2.2.2 Copy or Move to a Specified Path

Dragging and dropping is generally the quickest and easiest way to copy or move files and folders from one place to another. Typically, you must have both the source folder and the destination folder open and visible, which can add several steps to what should be a simple process. Furthermore, there's no provision for specifying a destination folder with the keyboard. The following procedures can be used to overcome these basic limitations.

2.2.2.1 Solution 1: Drag patiently
  1. Open Explorer (with the folder tree pane), and navigate to the source folder.

  2. Drag one or more items over the tree pane on the left, then hold the mouse cursor over the visible branch of the destination folder. After two or three seconds, Explorer will automatically expand the branch and make the subfolders visible.

  3. If the destination folder you're looking for is buried several layers deep, you'll have to wait for Explorer to expand each level. This requires a steady hand and a lot of patience.

2.2.2.2 Solution 2: Use cut, copy, and paste

This solution isn't exactly intuitive, but it can be convenient if you don't have a mouse or if your screen size limits the number of open windows:

  1. Select the file(s) you want to copy, right-click on it, and select Copy to copy the file or Cut to move the file. The keyboard shortcuts for the cut, copy, and paste operations are Ctrl-X, Ctrl-C, and Ctrl-V, respectively.

    If the file is cut, its icon will appear faded (as though it were a hidden file). If the file is copied, there will be no visual distinction.

  2. Open the destination folder (or click on the desktop), right-click on an empty area (or open the Edit menu), and select Paste. Whether the file is copied or moved or a shortcut is made depends on the same criteria as if you had dragged and dropped the item. Unfortunately, modification keystrokes discussed earlier in this chapter (Ctrl, Shift, and Alt) have no effect here, so you'll probably need a little trial-and-error.

Although Explorer uses the familiar cut, copy, and paste commands to accomplish this solution, they don't work exactly the same way for files as they do in other applications when you're manipulating text, for example.

If you cut a file and never get around to pasting it, or cut a second file without pasting the first, the first file that was cut is not deleted as you might expect. Cut, copy, and paste in the context of files work with file references rather than the files themselves, so unless you cut a file and then paste it into the Recycle Bin, there isn't much danger of losing anything. You can abort any cut operation by pressing Esc; the only visual feedback you'll get is that any "faded" file icons will return to their normal state.

Also, while you can drag-drop files from Explorer or the desktop into a running application to open the file in that application, the same isn't necessarily true for copy and paste. If you try to copy a file and then paste it into an application such as Word or Word Perfect, the file is inserted as an icon object directly into the document, which is not likely to be of much use to most people.

2.2.2.3 Solution 3: Use the Explorer toolbar

The standard Windows Explorer toolbar has two buttons, Move To and Copy To, that allow you to point to a location when moving and copying, respectively. Unfortunately, these functions can't be found in Explorer's menus or in the context menus of any files or folders; they're only available on the toolbar.

If Explorer's toolbar isn't currently visible, go to View figs/u2192.gif Toolbars figs/u2192.gif Standard Buttons to turn it on. By default, the Move To and Copy To buttons are in the sixth and seventh positions on the toolbar, respectively. If they're not, right-click on the toolbar, and select Customize.

2.2.2.4 Solution 4: Use a third-party add-on

The final solution is to install a separate utility to extend Explorer's capabilities. For example:

  1. Install Creative Element Power Tools (http://www.creativelement.com/powertools/).

  2. Enable the Copy or Move files anywhere tool.

  3. Right-click on any file or folder, select Move To or Copy To, and then type or point to the destination folder. You can also create new folders on the fly and duplicate paths in the destination folder; the software even remembers the last dozen destinations you specified.

2.2.3 Make a Duplicate of a File or Folder

Windows lets you copy and move files from one folder to another by dragging them with different combinations of keystrokes, as described earlier in this chapter. You can also rename a file by clicking on its name or highlighting it and pressing the F2 key. However, if you want to make a duplicate of a file in the same directory and assign it a different name, the process might not be as obvious. There are several different ways to do it:

  • Hold the Ctrl key while dragging a file from one part of the window to another part of the same window. This works in single-folder windows, on the desktop, and in Explorer.

  • Use the right mouse button to drag the file from one part of the window to another part of the same window, and then select Copy Here, as shown in Figure 2-3.

  • For keyboard enthusiasts, press Ctrl-C and then Ctrl-V to create a duplicate of a file using the clipboard.

Regardless of which solution you use, the duplicate of a file called, say, Myfile.txt would be automatically named Copy of Myfile.txt. An additional copy of Myfile.txt will be called Copy (2) of Myfile.txt, while a copy of Copy of Myfile.txt will be called Copy of Copy of Myfile.txt. Because the filename keeps changing (albeit somewhat inconveniently), you can duplicate multiple files simultaneously to fill a directory quickly with dozens of identical files.

If you need a bunch of duplicates of a file or folder, start by duplicating it once. Then, select both the original and the copy, and duplicate them both. Then, select the now four objects and duplicate them to make eight. Once you have all the duplicates you need, see Section 2.2.4, later in this chapter, for help in giving your duplicates more appropriate names.

 

If you duplicate a folder, all the contents of the folder will be duplicated, but only the name of the single folder will be changed the names of the files and folders therein will remain intact.

 

The Power Rename utility, part of Creative Element Power Tools (http://www.creativelement.com/powertools/), allows you to duplicate large numbers of files quickly, while controlling how the duplicates are named. See the next section for details.

2.2.4 More Ways to Rename Files

Renaming files is just as common a task as copying or moving, but it ends up being much more tedious to accomplish, at least when using Explorer.

In its simplest form, Explorer's rename feature works like this: highlight a file, wait a second (to avoid double-clicking) then click the filename, type a new name, and press Enter. You can rename an object by right-clicking and selecting Rename, or by selecting and pressing F2.

However, this method is laborious, especially if you need to rename a whole bunch of files or folders. And if you need to change a filename extension (see Section 4.3 in Chapter 4), then Explorer interrupts each renaming operation with a stern warning. The following solutions show other ways to rename files and overcome these limitations.

2.2.4.1 Solution 1: Select multiple files in Explorer

The following is the result of a new feature for Windows XP, though it leaves a lot to be desired:

  1. Select multiple files in Explorer, on your desktop, in a single-folder window, or in a Search Results window. See Section 2.1.3, earlier in this chapter, for different ways to select multiple files.

  2. Although multiple files will be highlighted, only one file will be the "active" file. At first, there will be no visual distinction, but if you press and release the Ctrl key, a dotted rectangle will appear around the name of the active file.

  3. The active file is important, since it's name will be used as a template to rename the other selected files. If the file marked as active is not the one you want to use, hold the Ctrl key while clicking another file. If the new file was highlighted, it will become de-selected in this case, just Ctrl-click the file once more to re-select it.

  4. Press the F2 key to rename the active file. Nothing will happen to the other selected files, at least not yet.

  5. Rename the active file as desired. When you're done, press Enter (or, press Esc to abort the operation without renaming any files). The active file will retain the newly typed name. Furthermore, all of the other selected files will assume the name of the active file, plus a number in parenthesis.

The rules that Explorer uses for renaming multiple files are as follows:

  • Each new filename begins with the full filename of the active file. Then, for all files except the active file, a blank space followed by a number in parentheses is appended to the filename.

  • The order in which the files currently appear in the folder is used to determine the numbers. The file that appers closest to the top of the listing is numbered "1," followed by "2," and so on.

  • File extensions are never changed, even if you purposely change the file extension of the active file. See Section 4.3 in Chapter 4 for more information on filename extensions.

Table 2-2 shows an example of what happens to five files renamed in this way.

 

Table 2-2. What happens when you try to rename multiple files in Explorer. The first file listed here is the "active" file, as described in Solution 1.

Old filename

New filename

My file.doc

The Penske File.rtf

Grandma.jpg

The Penske File (1).jpg

Readme.1st

The Penske File (2).1st

Purchases.mdb

The Penske File (3).mdb

Chapter 2 (a folder)

The Penske File (4)

 

Although there's no way to preview what your filenames will look like, you can undo a multiple rename operation as easily as a single rename operation. Simply press Ctrl-Z to revert the filenames, or in an Explorer or single folder window, go to Edit figs/u2192.gif Undo. Even though multiple files can be renamed in a single step using this procedure, each file is given it's own individual place in the "undo history." This means that if you rename seven files in a single step, you'll have to use the undo command seven times to revert them all.

2.2.4.2 Solution 2: Use the Command Prompt

This next solution uses the ren command, discussed in Appendix C, to rename any number of files using the traditional wildcard syntax:

  1. Open a Command Prompt window by going to Start figs/u2192.gif Programs figs/u2192.gif Accessories figs/u2192.gif Command Prompt, or by launching cmd.exe.

  2. Use the cd command, also explained in Appendix C, to change the working directory to the folder containing the files you wish to rename. For example, type:

    cd c:\stuff

    to change to the c:\stuff folder. For long folder names, there's a shortcut: just type cd, followed by a space, and then drag a folder icon onto the Command Prompt window. The full path of the folder will be typed for you.

     

    Since the ren command only works in one folder at a time, you can't rename files in multiple folders in a single step, like you can with the other solutions in this section. However, you can use batch files or WSH scripts, discussed in Appendix C and Chapter 9, respectively, for more flexibility and automation.

     

  3. The syntax of the ren command is as follows:

    ren source destination

    where both source and destination can be any combination of permissible characters and wildcards. Two wildcards are allowed: an asterisk (*), which is used to match any number of characters, and a question mark (?), which is used to match only a single character.

The following examples illustrate the use of the ren command:

Rename a single file

ren oldfile.txt newfile.txt

Change the extension of all .txt files to .doc

ren *.txt *.doc

Rename the first part of a filename without changing the extension

ren document.* documentation.*

Remove the extensions of all files in the folder

ren *.* *.

Change the first letter of all files in a folder to "b"

ren *.* b*.*

Add a zero in front of numbered chapter files

ren "chapter ??.wpd" "chapter0??.wpd"

Note the use of quotation marks here to accomodate the spaces in the filenames. Also, note how the zero fills the space in the original filenames; "inserting" a zero is a bit more complicated.

Rename all files with a "s" in the fourth position so that a "t" appears there instead

ren ???s*.* ???t*.*

Truncate the filenames of all files in the folder so that only the first four characters are used

ren *.* ????.*

Here are few additional notes for using ren to rename files:

  • Using wildcards takes a bit of practice and patience. The more you do it, the better intuitive sense you'll have of how to phrase a rename operation. To make things simpler, try issuing several successive ren commands instead of trying to squeeze all your changes into a single step.

  • If a naming conflict occurs, the ren command will never overwrite a file. For example, if you try to rename Lisa.txt to Bart.txt, and there's already another file called Bart.txt, ren will display an error and no renaming will occur.

  • The source is always case-insensitive, in that capitalization doesn't matter when matching files. However, the capitalization you use for destination is preserved.

  • Ren isn't able to insert characters, only replace them. This makes it difficult to make filenames shorter or longer using wildcards.

  • Use batch files to execute a series of ren statements, as described in Appendix C.

2.2.4.3 Solution 3: Use a third-party add-on

The third solution is to install a separate utility to allow more sophisticated renaming operations:

  1. Install Creative Element Power Tools (http://www.creativelement.com/powertools/).

  2. Enable the Rename files with ease tool.

  3. Select one or many files to rename, right-click, and select Power Rename. Or open the Power Rename utility and drag-drop the files onto the window.

  4. Select the desired renaming criteria to your right. The first option, As Specified, allows you to type a file specification with wildcards, as described in Solution 2, earlier.

    Otherwise, choose With Operation, and then choose the options later, such as Append filename, Re-number, Change Case, or Replace.

  5. Turn on the Show what files will look like option to see a preview of the filename(s).

  6. Click Apply when you're done.

    If you wish to make duplicates (see Section 2.2.3, earlier in this chapter), turn on the Leave original files (copy) option, and click Apply repeatedly, once for each duplicate you wish to create.

2.2.5 Make It Easier to Delete Files

Deleting files and folders is something we do every day, but under Windows XP's default settings, deleting a single file or a group of files can incur a whole slew of confirmation messages, and the results can be somewhat unpredictable.

The number and type of confirmation messages you get depends on settings in your Recycle Bin. For example, if your Recycle Bin is configured to store deleted files (the default), but not confirm their deletion, you may not see any warning message at all. The key is to cut out the unnecessary messages without completely eliminating the safeguards that help prevent accidental deletion.

Let's start by examining some of the Recycle Bin settings and their consequences. Right-click the Recycle Bin icon on your desktop, and select Properties. The various options here are pretty self-explanatory, but the following tips may help:

  • If your Recycle Bin is configured to store deleted objects, you can get back accidental deletions by opening the Recycle Bin and dragging items out of it. If, instead, you've configured the Recycle Bin to delete files immediately, you'll need an undelete program (such as the one that comes with Norton Utilities) to get them back.

    You can also right-click any empty area of a folder or the desktop and select Undo Delete (assuming the last thing you did was delete an object), but only if you've configured the Recycle Bin to store your deleted objects.

  • If you highlight an object and press the Del key, or right-click an object and select Delete, it has the same effect as dropping the object into the Recycle Bin. All the Recycle Bin settings apply regardless of the method used to actually delete the object. The exception is the Command Prompt's del command (discussed in Appendix C), which deletes files without confirmation screens and without storing them in the Recycle Bin.

    In fact, you may want to use del to quickly and easily delete one or more files sharing a common trait, such as the filename extension. Just type del *.tmp to delete all files with the .tmp extension in the active folder, for example (see Solution 2 in Section 2.2.4, earlier in this chapter for more information on this syntax). The del command often completes its tasks more quickly than the Recycle Bin, especially for large numbers of files. Command-prompt commands also have the added benefit of deleting files without forcing you to stare at the flying paper animation.

  • It's possible to permanently delete an object in Windows XP without any confirmation dialog box whatsoever, a feature you should, of course, use with caution. To do this, open the Recycle Bin Properties, and turn on the Do not move files to the Recycle Bin option. Next, turn off the Display delete confirmation dialog box, and click OK when you're done. This doesn't get rid of all nag windows, though only the ones for ordinary files. See below for exceptions.

  • If you have more than one drive, the settings for each drive's Recycle Bin (shown as separate tabs in the Recycle Bin Properties window) can be set independently. Settings for a particular drive apply to all files deleted on that drive. For example, if drive C: is set to store deleted files, but drive D: is not, then only files deleted from drive C: will be recoverable. For this reason, it's usually best to specify Use one setting for all drives in the Recycle Bin Properties.

  • The amount of disk space devoted to the Recycle Bin is specified as a percentage of the amount of free disk space per drive, rather than a fixed number of megabytes. This means that the size of your Recycle Bin will constantly change as the amount of free space changes, and the size of the Recycle Bin on each of your drives will always be different. Now, if you delete a 15-MB file and only 10 MB are available to the Recycle Bin, Windows will delete the file outright instead of storing it (it may warn you first).

  • If you have your Recycle Bin configured to store deleted files, it will hold them until it becomes full and then will permanently erase the oldest contents to prevent "overflow." This means you will never be able to predict how long a deleted file will remain in the Recycle Bin: a sensitive file may stay in there for weeks, presenting a possible security hazard. Likewise, an accidentally deleted file may disappear after only a few hours (or less), long before it occurs to you to double-check the contents.

    The lesson: be careful when deleting files, be diligent about checking your Recycle Bin, and give some thought to the Recycle Bin settings.

Why would you want files to be stored in the Recycle Bin? It gives you a way out: if you find that you are careless and delete important files accidentally, you should definitely exploit this feature.

Why would you not want files to be stored in the Recycle Bin? First of all, those files don't exist in a vacuum; they take up valuable hard-disk space and can slow system performance. Deleted files are a security risk; it's one of the first places I'd look for sensitive information if I were breaking into someone's system. And, having unwanted files remain on your hard disk can make your system more vulnerable to hard-disk crashes (from corrupted files) and viruses (from email attachments you thought you deleted right away).

There are a few workarounds for whatever Recycle Bin settings you choose, allowing more flexibility and control. For example, if you've configured your Recycle Bin to store deleted files, you can still hold the Shift key while deleting any given object to permanently erase the object. The files currently stored in the Recycle Bin (if any) will not be affected.

The following are all of the confirmation and warning messages you may receive when deleting files, and, where applicable, how to bypass them:

  • By default, you'll get a nag window when you first drop any file or folder onto the Recycle Bin or delete them with the Del key. This can be bypassed by turning off the Display delete confirmation dialog option.

  • You'll be warned if you try to delete a file that has the read-only or system attributes set. The only way to curb this is to first turn off said attributes by right-clicking the file(s) and selecting Properties.

  • Explorer will warn you if the file that's being deleted is an .exe file. However, it won't warn you when deleting .dll or .ocx files, even though they're just as necessary as .exe files for the applications that own them. There's no way to change this behavior.

  • If you delete certain shortcuts in your Start Menu, Explorer will stop you to explain that you're not actually deleting the software to which it links. This is actually a property of said shortcuts and cannot be changed globally.

  • You'll get a warning message if the files you're trying to delete are larger than the space you've allocated for the Recycle Bin. You can fix this by increasing the allocated space (move the slide bar to the right). This doesn't apply if you've enabled the Do not move files to the Recycle Bin option.

  • Windows will give you a stern warning if you try to delete (or rename) a folder that contains (or once contained) an application, explaining that the application will no longer work. This only happens if the folder is referenced in the Registry. Since it's easier to just click OK rather than first removing all Registry references, there's no practical workaround to this one, either.

  • Finally, you'll be asked to confirm that you actually wish to empty the Recycle Bin, regardless of the size or number of files currently inside.

2.2.6 How to Delete or Replace In-Use Files

Regardless of the number of confirmation windows Explorer will throw at you, eventually, you'll be allowed to delete the file or folder you're trying to get rid of. The only case when Windows XP simply won't allow you to delete (or replace) something is when that file or folder is "in use" by a running application or by Windows itself.

This is a safety mechanism, not only in place to prevent a running application executable or support file from being deleted while said application is running, but to prevent a document from being modified or deleted by an application other than that which has opened the document.

 

Remember, Windows makes it difficult to delete in-use files for a reason. If you delete certain files in your \Windows or \Windows\System folders, you can render Windows inoperable. However, there are plenty of files that can be deleted or replaced safely. Use these solutions at your own risk, and check out Chapter 6 for tips on securing your system with a backup.

 

2.2.6.1 Solution 1: Close the application

The easiest way to delete an in-use file is to simply close the application that owns it. If the file belongs to an invisible background program, use the Windows Task Manager (taskmgr.exe) to end the process. If it belongs to a service, use the Services window (services.msc) to stop it.

But what happens if the file is in use by the operating system? If you need to replace a .dll file in the \Windows\System folder, for example, Windows won't let you do it. But never fear! The remaining solutions should take care of it.

2.2.6.2 Solution 2: Use the Command Prompt

The Command Prompt, discussed in Appendix C, sometimes is able to access files that Explorer won't let you touch.

  1. Open a Command Prompt window by going to Start figs/u2192.gif Programs figs/u2192.gif Accessories figs/u2192.gif Command Prompt, or by launching cmd.exe.

  2. Use the cd command to change the working directory to the folder containing the file(s) you wish to delete. See Solution 2 in Section 2.2.4, earlier in this chapter, for additional tips on the cd command.

  3. Use the del command to delete the file, like this:

    del filename.ext

    where filename.ext is the name of the file.

If this doesn't work, try the next solution.

2.2.6.3 Solution 3: Brute force

Occasionally, simply renaming the file is enough to break Windows' hold on a shared file. If this doesn't work, restart Windows, and then try deleting again.

2.2.6.4 Solution 4: Use the Safe Mode with Command Prompt

Windows XP has a special way to get to the Command Prompt (discussed in Appendix C) without loading most of the rest of the operating system. Here's how to get to it:

  1. Restart your computer.

  2. Just after the system beep, but before the Windows startup logo appears, press the F8 key to display the Windows Advanced Options Menu.

  3. Use the up and down arrow keys to highlight Safe Mode with Command Prompt (the third one from the top), and press the Enter key.

  4. When the Command Prompt window appears, use the del or ren commands discussed in Appendix C to delete or rename the file in question, respectively.

  5. When you're done, restart your computer by typing:

    shutdown -s -t 0

    Or, press Ctrl-Alt-Del and then click Shut Down.

2.2.6.5 Solution 5: Use the Recovery Console

The Recovery Console is essentially a way to get to the Command Prompt when Windows isn't running at all. The Recovery Console operates at a lower level than the Safe Mode with Command Prompt, discussed in the previous solution, and will allow you to delete in-use files that otherwise can't be touched. It also provides access to your system when Windows won't start. See Chapter 10 for more information on the Windows Recovery Console.

2.2.6.6 Solution 6: Use Wininit.ini

The final solution is that which is implemented by the installation programs used to install software on your computer.

  1. Open Explorer, and navigate to your \Windows folder.

  2. Double-click the Wininit.ini file to open it in Notepad (or any other standard plain text editor).

    If the file isn't there, just create a new empty text file, and name it Wininit.ini, and type the following line at the top:

    [rename]

    In most cases, the Wininit.ini file will exist but will be empty, with the exception of the [rename] line. Any other lines here would've been added by a recent application install. See Section 3.2.4 for more information on the structure of this type of file.

  3. Under the [rename] section header, type the following line:

    NUL=c:\folder\filename.ext

    where c:\folder\filename.ext is the full path and filename of the file you wish to delete. You can specify as many files here as you want, one on each line.

    If you wish to replace a file rather than simply deleting it, the syntax is a little different:

    c:\folder\existing.ext=c:\folder\replacement.ext
  4. where c:\folder\existing.ext is the full path and filename of the file you're trying to replace, and c:\folder\replacement.ext is the full path and filename of the new file to take its place. If the file specified on the right side of the equals sign doesn't exist, then the existing.ext file will be moved/renamed to c:\folder\replacement.ext.

  5. Restart Windows. The files will be deleted or replaced as specified during the startup procedure.

2.2.7 Fix the Search Tool

Most of us rely on the Windows Search tool on a daily basis to find and organize files in Explorer. However, Microsoft has redesigned the Search tool in Windows XP in an effort to make it more inviting for novice users, but at the expense of the simplicy and efficiency found in earlier versions.

There are two primary issues with the Search tool that we'll address here: the cumbersome new interface and the fact that starting Search from within Explorer doesn't open it in a new window. Finally, we'll end the discussion with a bunch of Search tips. Together, these solutions should help make the Windows XP Search tool a lot more useful and a lot less annoying.

2.2.7.1 Part 1: The new Search interface

Ok, I'll admit it. The dog is cute. Being an animal lover, you'd think I'd appreciate having him down there wagging his tail and "helping" me find my files. But it took me less than two minutes to get tired of the cumbersome wizard-like interface, the overabundance of unnecessary choices, and the little scratching sounds the puppy makes while you're trying to work.

Ideally, when one opens a Search window, all of the important fields and options should be accessible immediately, without any additional nonsense, and without disrupting the existing workspace. Unfortunately, that's not what Microsoft had in mind, as shown in Figure 2-4.

Figure 2-4. The puppy sleeps while you wade through the cumbersome Search menus.

figs/xpan_0204.gif

When you open the Search tool (see Part 2, later for ways to start a Search), you're presented with a menu asking, "What do you want to search for?" and eight possible destinations. The first three destinations all basically do the same thing, but require that you first make a distinction about what type of file you're looking for, or rather, try to predict how Windows will categorize the file for which you're looking. For example, is that Photoshop document you were working on a "picture" or is it a "document?"

All files and folders is the obvious choice, as it will likely be in most situations. To skip this menu in the future and go straight to the All files and folders search tool, click Change Preferences, then Change files and folders search behavior, and then choose Advanced. Fortunately, Explorer will remember your preference, and you won't have to deal with the menu again unless you want to.

You may have noticed that this choice is rather buried in the Change Preferences menu; all the other options here simply affect the Search Companion (the little puppy dog, by default). Click Without an animated screen character to say bye-bye to "Rover," or click With a different character to choose between Rover, Merlin (a wizard), Earl (a surfboarding banana), or Courtney (anybody's guess). Unfortunately, there's no way to disable the sounds the different characters make; if it weren't for this limitation, I'd probably still have the puppy on my system.

If you like the puppy, you'll be happy to know that he won't leave if you choose the Advanced option, described earlier, to bypass the menus and go straight to the Search form. Double-click the animated character at any time to turn him/her off, choose a different character, or to make him/her do a trick for you.

Once you're looking at the so-called "Advanced" view of the Search tool, any searches you perform will be relatively open. That is, you won't be restricted by a "type" of file to look for, unless you want to be. The When was it modified, What size is it, and More advanced options choices allow you to refine your search beyond simply the filename and location, further filtering the search results as needed. See Part 3 for more search tips.

2.2.7.2 Part 2: The Search pane in Explorer

If you've become accustomed to the Find tool in Windows 95/98/NT 4.0, you'll notice that the Search tool in Windows XP is roughly equivalent, except that the search results appear to the right of the controls rather than beneath them. Other than this horizontal layout, more closely resembling the standard Explorer window, and the extraneous menus discussed in Part 1, above, there's not a whole lot different with this new tool. (Windows Me and Windows 2000 have something much closer to the Windows XP Search tool, though.)

The problem becomes obvious when the Search tool is invoked from within an open Explorer window: the left pane containing the folder tree simply disappears! Furthermore, the contents of the currently selected folder remain visible in the right pane, but vanish as soon as a search is performed. The two ways to reproduce this are as follows:

  • Press Ctrl-F, Ctrl-E, or F3 in Explorer or any single-folder window.

  • Select Explorer Bar and then Search from Explorer's View menu, or click the Search button on the Explorer toolbar.

The fact that the current window is reused for the Search tool has no apparent benefit, yet it inconveniently and frustratingly interrupts your workspace, which is the last thing you want when you're looking for something.

The only way to return to the previous view at this point is to select Explorer Bar and then Folders from Explorer's View menu unfortunately, there's no keyboard shortcut, so this procedure is especially cumbersome. When the folder tree pane is reinstated, a new folder, Search Results, appears at the bottom of the tree. However, if you select another folder and then return to this Search Results folder, neither the search criteria nor the search results from your last search are retained. In other words, there's absolutely no point to this design.

The solution is to find a way to activate the Search tool so this doesn't happen, which essentially involves opening Search in a new window, leaving any open Explorer windows intact. There are four ways to do this:

  • Select Search and then For Files or Folders from the Start Menu. Local Hard Drives will be automatically selected in the Look in list. If you wanted to start your search from the folder you were viewing, you'll have to select it manually from the Look in list.

  • Click on the desktop, and then press F3. The Desktop will automatically be selected in the Look in list. Likewise, you'll have to select another folder manually from the Look in list if the Desktop is not where you wish to search. (Strangely, the Ctrl-F keyboard shortcut doesn't work on the Desktop, even though it works everywhere else.)

  • Right-click on any folder icon on the desktop or in either pane of an Explorer window (drive icons also work), and select Search. A new window will appear, and the selected folder or drive will automatically appear in the Look in list.

  • Obtain Creative Element Power Tools (http://www.creativelement.com/powertools/), which comes with a fix for the Search tool. With this utility, pressing Ctrl-F or F3 in an open Explorer window will force a new Search window to open and the current folder to be placed in the Look in list.

2.2.7.3 Part 3: Search tips

Here are some additional tips for working with the Search tool:

Working with Search Results

The Search Results listing is an active list of the files and folders that match your search critera. This means that you can double-click any found document, application, or folder to open it. You can also drag icons from the Search Results window or right-click them in place to view their context menus, just as though you were looking at them in their native folders.

For broader context, just highlight any single item and select Open Containing Folder from the File menu, and its parent folder will be opened with said object selected automatically.

Stretch out

The Search Results window is usually not large enough to display all pertinent information. Make it bigger so you can see the In Folder column, for example (Details view only), which tells you the full path of each item in the listing.

While we're at it, make sure the Status Bar is visible (go to View figs/u2192.gif Status Bar). The Search tool displays both its progress and a summary of its results in the Status Bar at the bottom of the Search window.

Sometimes it's easier to search for everything

If you initiate a search and leave the All or part of the file name field empty, the search results will just fill up with all files and folders in the specified location. This is very useful, as it will quickly allow you to find the newest or even largest files in the specified location. Just make sure you're using the Details view (select View figs/u2192.gif Details), and then click the appropriate column headers to sort the listing accordingly.

Note that the arbitrary 10,000 file limit imposed in some earlier versions of Windows has been lifted in Windows XP. For anyone who has been around long enough to remember XTree, this is equivalent to its fabulous "Show All" feature.

Save your search settings

There's also another way to open a Search window without disrupting an Explorer window. This solution has the added benefit of allowing you to save the default search location (sort of) and any other search options:

  1. Open a Search window and select a search location and any other search options. Leave the All or part of the file name field empty for now.

  2. Click Search Now to perform a search. The specific results that appear right now aren't important, though.

  3. When the search is complete, select Save Search from the File menu. When prompted, navigate to the Desktop, and type whatever you like for the filename; something generic, such as Search.fnd, might be suitable.

  4. Double-click on the new Search.fnd file at any time to open a new Search window with your settings. You can make as many of these as you like, and place them in on your Desktop, in your Start Menu, or even on a QuickLaunch toolbar for quick access.

  5. If you want to assign a keyboard shortcut to this new Search icon, start by moving the saved search file to a safe, out-of-the-way location. Create a shortcut to the file and place it in the same folder, in your Start Menu, or anywhere else that is convenient.

    Right-click on the new shortcut, click Properties, click on the Shortcut key field, and press the desired keystroke combination. Unfortunately, Windows won't let you choose a shortcut key combination with only the Ctrl key, so you can't redefine Ctrl-F for this window (believe me this is the first thing I tried). However, Ctrl-Shift-F is almost as convenient and may serve as a suitable compromise. Click OK when you're done, then try it out!

Looking for text in files

If you're looking for text in a file, as opposed to the filename, the Windows XP Search tool doesn't actually work that well. Several times I've tested it by looking for text in a folder full of ordinary text files (no exotic file formats or anything), and Search couldn't find the text I knew to be in there. If you run into this problem, try UltraEdit-32 (http://www.ultraedit.com), and use the Search figs/u2192.gif Find in Files command instead.

Stop Search from looking in ZIP files

As described in the next topic, "Working with ZIP Files," support for the ZIP file format is built-into Windows XP. Whether you like this ZIP integration or not, it does mean that the Search tool will include the files inside of any ZIP archives it encounters, just as though they were in ordinary folders.

This negatively impacts the Search tool in two ways. First, it can increase search time considerably; every ZIP file found in your search will have to be opened and its contents extracted. Second, if any files matching your search critera are found inside a ZIP file, they will appear normally in the search results, but the In Folder column will be blank for these items, making it that much more difficult to find where said files are actually located.

Unfortunately, there's no way to stop Search from looking in your ZIP files without disabling Windows XP's built-in support for ZIP files. But if you do disable ZIP integration, you can always install a separate ZIP utility that won't interfere with searches and may provide more functionality as well.

The places Search won't look

The following folders are places in which Search won't look for files:

  • Your Fonts folder: \Windows\Fonts

  • Deleted files stored in the Recycle Bin: \Recycler

  • Restore points for System Restore: \System Volume Information

Furthermore, unless you turn on the Search system folders and Search hidden files and folders options (located under More advanced options), hidden and system files will be ignored in searches. Strangely, these settings are not connected to the settings in the Folder Options window that affect the visibility of hidden and system files in Explorer (discussed earlier in this chapter).

2.2.8 A Crash Course on File Organization

One of the best ways to improve file searches is to do organize your files more efficiently in the first place. When you're saving files, Windows takes a few measures to ensure your files are at least placed in the My Documents folder, but beyond that, it's up to you.

The "old school" methodology is to place your personal files in folders designated for the applications that created them: all your spreadsheet files in one folder, all your word processor documents in another, and all photos in yet another. The problem with this is that the context of your files is so easily lost.

The most efficient way to organize your personal files is to group them by project or topic, rather than the applications that created them. Figure 2-5 shows the tree view of a typical My Documents branch organized in this way.

Figure 2-5. An example of how to organize your personal documents into descriptively-named top-level folders.

figs/xpan_0205.gif

Here are some tips for organizing your files:

Ignore file types

All your files, regardless of the programs that created them, should be organized without regard for the file types: your word processor documents, email attachments, database files, photos, drawings, and downloaded Acrobat (.pdf) documents, can all sit side-by-side in the same folders, separated only by topic.

Just open a folder corresponding to the project on which you wish to work, and double-click a document to open the appropriate application to edit or view it. See Section 4.3 in Chapter 4 for more information on the link between your documents and applications.

The same applies to your Internet Explorer Shortcuts and Netscape Bookmarks. Rather than grouping all your links in the same place, create Internet Shortcuts in these project folders. Place links to online gardening web sites in the Garden folder, right next to the spreadsheet containing an index of all your plants and the email attachments sent by your gardening friends. Then, just double-click your Internet Shortcuts to open the corresponding pages in your default web browser.

Keep it simple

It's best not to introduce too many levels of organization (i.e., folders within folders within folders), as these end up just making the data harder to find. For example, I could have grouped the Furniture, Garden, and Remodel folders and put them in another folder called Home Improvement, but what would've been the point? This way, all of my categories, so-to-speak, are visible right at the top level, and I can find the ones I want without having to hunt for them or open a bunch of intermediate folders.

Keep your Desktop clean

The Desktop is commonly a receptacle for files of all types, but this often leads to a ton of clutter. Instead of placing your working documents on your Desktop, put them in your projects folders right away. Then, to provide quicker access, make Windows Shortcuts to your most frequently-accesed projects folders; see Section 2.1.4, earlier in this chapter, for instructions on opening an Explorer window rooted in an arbitrary location, like the one shown in Figure 2-5.

A common root pays off down the road

It's a good idea to root all your projects folders in the same place. The My Documents folder is an especially convenient location for this, mostly because many File figs/u2192.gif Open and File figs/u2192.gif Save dialogs open to My Documents by default. Note that you can rename the My Documents folder to something a little less cutesy, or you can even change the location of the folder using TweakUI (see Appendix A). Another advantage to rooting all your projects folders in the same place is that it makes it easier to collect all your personal data, both for backups and when it comes time to upgrade your computer.

When to use My Pictures, My Videos, My eBooks, etc.

Windows XP installs several predefined folders in your My Documents folder, such as My Pictures and My Music, in an attempt to influence you to organize your files by content type, rather than topic or project. This, of course, contradicts the strategy explained here, as well as the system imposed by some of Microsoft's earlier efforts, such as the My Documents folder.

But why is Microsoft trying to organize your documents for you? Well, there are three reasons for the existance of these folders:

  1. First, if you have the common tasks pane enabled (discussed at the beginning of this chapter), certain additional links will appear for different folders. For example, when you open My Pictures, a special Picture Tasks will appear at the top of the tasks pane, with links to such features as View as a slide show and Order prints online.

  2. Next, some folders have different default view settings; for example, the default view in My Pictures is Thumbnails. This is intended to be convenient, but doesn't always end up that way. See Section 4.3.7 for more information.

  3. Finally, certain applications are designed to look in these folders for the types of files they typically support. The Windows Movie Maker, for example, opens, by default, to the My Videos folder (if it exists).

Naturally, though, it sometimes does make sense to use these folders. For example, any MP3s you've downloaded or ripped from CDs are likely to be all located in the same place anyway and putting them in the My Music folder will afford you the advantages described earlier.

Note that you can change the location of any of these system folders using TweakUI (see Appendix A), either to redirect them to existing folders or to consolidate them into a single folder. You can also safely and easily delete any of these folders, allowing you to organize your documents more appropriately. The exception is the My Pictures folder, which, if deleted, will be automatically recreated the next time Windows starts.

2.2.9 Working with ZIP Files

Phillip Katz conceived of the ZIP file format at his mother's kitchen table in 1986, and soon thereafter wrote a little program called PKZip. Although his program, capable of encapsulating and compressing any number of ordinary files and folders into a single archive file, was not the first of its type, it quickly became a standard and ended up revolutionizing the transfer and storage of computer data.

Although ZIP files have been the de-facto standard in file compression for more than fifteen years, Windows XP is the first version of Windows to come with support for ZIP files built-into the operating system.

Zip files work somewhat like folders in that they "contain" files, so its not surprising that they're represented as folders in Explorer. But a ZIP file is typically smaller than the sum of its contents, thanks to the ZIP compression scheme. For example, a folder with ten spreadsheet documents might consume 8 MB of disk space, but when zipped, might only consume 3 MB (or even less). The level of compression varies with the type of data being compressed; zipped text documents can be as small as 4 or 5% of the size of the original source files, but since movies and images are already compressed, they'll only compress to 95% to 98% of their original size, if that.

This compression makes ZIP files great for shrinking data down before emailing or otherwise transmiting over an Internet or network connection, since smaller files can be sent faster. Furthermore, since a single ZIP file can encapsulate a bunch of separate files, sending ZIPs is that much more convenient.

 

There are other compression schemes out there, although none have achieved the popularity of ZIP. In fact, a few years back, a new archive format was introduced that claimed much better compression than ZIP: archives made with this new scheme ended up roughly one hundredth the size of corresponding ZIP files. The only problem was that this was a one-way process; files that were compressed and later extracted unfortunately bore no resemblence to the original source files. Might as well stick with ZIP . . .

 

To open a ZIP file, just double-click it. You can extract files from ZIP archives by dragging them out of the ZIP folder window. You can also right-click a ZIP file and select Extract All, but you'll have to deal with a more cumbersome wizard interface.

You can create a new ZIP file by right-clicking on an empty portion of the desktop or in any open folder, and selecting New figs/u2192.gif Compressed (zipped) folder. (The name here is actually misleading, since ZIP archives are actually files and not folders.) You can compress new files into ZIP archives by simply dragging them onto the New Compressed (zippped) folder.zip file icon, or into an open ZIP folder window.

Another way to compress a file, folder, or group of files and folders into a ZIP archive is to select them, right-click, select Send To, and then Compressed (zipped) folder. This is especially convenient, as there's no wizard or other interface to get in the way. For example, if you send the folder CompuGlobalHyperMegaNet to a ZIP file, Windows will compress the folder's contents into CompuGlobalHyperMegaNet.zip and place the new archive alongside the source folder.

 

The ZIP archive format has built-in error checking. If you find that certain file types become corrupted when emailing or downloading from the web, try putting them in a ZIP file to "protect" them.

 

There are some drawbacks to the integration with ZIP files in Windows XP. For example, it can interfere with searches, as described in Section 2.2.7, earlier in this chapter. It can also interfere with third-party ZIP utilities, many of which provide more funcionality than the rudimentary ZIP support in Windows XP. For example, the WinZip utility (http://www.winzip.com) adds a bunch of handy commands to your context menus and even to the right-drag menus (discussed in Section 2.2.1, earlier in this chapter). Also, it treats ZIP archives more like files and less like folders, which many users may prefer.

If you wish to use another program to work with ZIP files, you should first disable Windows's built-in ZIP integration:

  1. Go to Start figs/u2192.gif Run.

  2. Type the following at the prompt and click OK when you're done:

    regsvr32 /u %windir%\system32\zipfldr.dll
  3. The change will take effect immediately, but you may have to restart Windows for all traces of the built-in ZIP support to disappear.

If, at any time, you wish to re-enable Windows XP's built-in ZIP support, just follow these steps:

  1. Go to Start figs/u2192.gif Run.

  2. Type the following at the prompt and click OK when you're done:

    regsvr32 %windir%\system32\zipfldr.dll
  3. The change will take effect immediately, but you may have to restart Windows for all traces of the built-in ZIP support to once again become available.

2.2.10 Clean up Windows Shortcuts

Windows Shortcuts are nothing special; they're just files (with the .lnk extension)[5] that contain "pointers" to the files, folders, programs, or system objects to which they link.

[5] The .lnk extensions for Windows Shortcuts will always be hidden, even if you've configured Windows to display your filename extensions, as described earlier in this chapter.

Windows gives you four ways of distinguishing shortcuts from other files:

  • When first created, a shortcut's caption begins with the text, "Shortcut to."

  • The shortcut's icon also has a small curved arrow in the lower-left corner, as shown in the "before" icon in Figure 2-6.

  • If you're viewing the folder containing the shortcut in Details mode, the Type column will read either Shortcut, Shortcut to MS-DOS Program, or Internet Shortcut for .lnk, .pif, and .url shortcut files, respectively. This information is also available in the shortcut's Properties sheet.

  • Finally, shortcuts are small: typically only a few hundred bytes, regardless of the size of the objects to which they link.

Figure 2-6. Cleaning up Windows shortcuts: before and after.

figs/xpan_0206.gif

Naturally, you can rename a single shortcut to get rid of the aforementioned "Shortcut to," but ensuring that the text isn't added to newly created shortcuts is a different matter. And there's no setting anywhere in the Windows interface for removing the little arrow icon. To turn off these artifacts for good on all shortcuts, use the following instructions.

2.2.10.1 Part 1: Remove the "Shortcut to" prefix
  1. Create a shortcut any shortcut.

  2. Rename the shortcut (right-click and select Rename or select and press F2), and manually remove the "Shortcut to" portion of the name.

  3. Delete the shortcut when you're done.

  4. Repeat these steps eight times in succession. You'll know when the change has been made when the ninth shortcut is created with the "Shortcut to" prefix.

Keep in mind that this is a one-way change; there's no way to undo it without using the TweakUI utility, described next.

2.2.10.2 Part 2: More complete control

This next solution uses Micrsoft's TweakUI utility for more contorl over the appearance of Windows Shortcuts.

  1. Open TweakUI (see Appendix A) and expand the Explorer category.

  2. The Prefix "Shortcut to" on new shortcuts option appears in the Settings list. If you've used the previous solution to disable the "Shortcut to" prefix, the option will already be turned off. Turn it off or on as desired.

  3. Next, open the Shortcut category (it's under Explorer).

  4. To disable or change the curved arrow icon, choose the desired option in the Shortcut overlay section: Arrow (the default), Light arrow, or None to disable it completely. If you choose Custom, you can choose any icon, although it should be 16 X 16 or smaller, or partially transparent, so as not to obscure the original icon.

  5. Click OK when you're done. The changes should take effect immediately.

Note that if you disable the "Shortcut to" prefix with either of these two solutions, the change will be in effect for newly created shortcuts only; naturally, it won't automatically change the filenames of existing shortcuts.



Windows XP Annoyances
Fixing Windows XP Annoyances
ISBN: 0596100531
EAN: 2147483647
Year: 2005
Pages: 78
Authors: David A. Karp

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