Windows XP Professional supports two types of compression: NTFS compression and Compressed Folders. NTFS compression enables you to compress files, folders, or an entire drive. NTFS compressed files and folders occupy less space on an NTFS-formatted volume, which enables you to store more data. Each file and folder on an NTFS volume has a compression state, which is either compressed or uncompressed. The Compressed Folders feature allows you to create a compressed folder so that all files you store in that folder are automatically compressed.
The Compressed Folders feature is new in Windows XP Professional and provides the ability to create compressed folders and view their contents. The Compressed Folders feature in Windows XP Professional allows you to compress large files so that you can store more files on a floppy disk or hard drive.
To create a compressed folder, start Windows Explorer, click File, click New, and then click Compressed Folder. This creates a compressed folder in the current folder. You can drag and drop files into the compressed folder and the files are automatically compressed. If you copy a file from the compressed folder to another that is not compressed, that file will no longer be compressed. A zipper icon is shown, marking compressed folders (see Figure 14.1), and these folders are labeled Compressed Folder.
Figure 14.1 A compressed folder showing the zipper icon
Benefits of using compressed folders generated with the Compressed Folders feature include the following:
NTFS compressed files can be read and written to by any Windows-based or MS-DOS-based application without first being uncompressed by another program. When an application, such as Microsoft Word 2000, or an operating system command, such as Copy, requests access to a compressed file, NTFS automatically uncompresses the file before making it available. When you close or explicitly save a file, NTFS compresses it again.
NTFS allocates disk space based on uncompressed file size. If you copy a compressed file to an NTFS volume with enough space for the compressed file, but not enough space for the uncompressed file, you might get an error message stating that there is not enough disk space for the file, and the file will not be copied to the volume.
You can set the compression state of folders and files and you can change the color that is used to display compressed files and folders in Microsoft Windows Explorer.
If you want to set the compression state of a folder or file, right-click the folder or file in Windows Explorer, click Properties, and then click Advanced. In the Advanced Attributes dialog box, shown in Figure 14.2, select the Compress Contents To Save Disk Space check box. Click OK, and then, in the Properties dialog box, click Apply.
NTFS encryption and compression are mutually exclusive. For that reason, if you select the Encrypt Contents To Secure Data check box, you cannot compress the folder or file.
Figure 14.2 The Advanced Attributes dialog box
To change the compression state for a file or folder, you must have Write permission for that file or folder.
The compression state for a folder does not reflect the compression state of the files and subfolders in that folder. A folder can be compressed, yet all of the files in that folder can be uncompressed. Alternatively, an uncompressed folder can contain compressed files. When you compress a folder that contains one or more files, folders, or both, Windows XP Professional displays the Confirm Attribute Changes dialog box, shown in Figure 14.3.
Figure 14.3 The Confirm Attribute Changes dialog box
The Confirm Attribute Changes dialog box has the two additional options explained in Table 14.1.
Table 14.1 Confirm Attribute Changes Dialog Box Options
Option | Description |
---|---|
Apply Changes To This Folder Only | Compresses only the folder that you have selected |
Apply Changes To This Folder, Subfolders, And Files | Compresses the folder and all subfolders and files that are contained within it and subsequently added to it |
You can set the compression state of an entire NTFS drive or volume. To do so, in Windows Explorer, right-click the drive or volume, and then click Properties. In the Properties dialog box, select the Compress Drive To Save Disk Space check box, as shown in Figure 14.4, and then click OK.
Figure 14.4 The Local Disk (C:) Properties dialog box
Windows Explorer makes it easy for you to quickly determine if a file or folder is compressed. By default, it displays the names of compressed files and folders in a different color to distinguish them from those that are uncompressed.
You can control the display of compressed files and folders in a different color by doing the following:
There are rules that determine whether the compression state of files and folders is retained when you copy or move them within and between NTFS and FAT volumes. The following list describes how Windows XP Professional treats the compression state of a file or folder when you copy or move a compressed file or folder within or between NTFS volumes or between NTFS and FAT volumes.
Figure 14.5 The effects of copying and moving compressed folders and files
When you copy a compressed NTFS file, Windows XP Professional uncompresses the file, copies the file, and then compresses the file again as a new file. This might cause performance degradation.
The following list provides best practices for using compression on NTFS volumes:
In this practice, you use NTFS compression to compress files and folders. You uncompress a file and test the effects that copying and moving files have on compression. In the last portion of the practice, you create a compressed folder using the Compressed Folders feature.
In this practice, it is assumed that you installed Windows XP Professional on the C drive and that the C drive is formatted with NTFS. If you installed Windows XP Professional on a different partition and that partition is formatted with NTFS, use that drive letter when the practice refers to drive C.
Run the Compression file in the Demos folder on the CD-ROM accompanying this book for a demonstration of creating a compressed folder using the Compressed Folders feature and using NTFS compression to compress files and folders, and testing the effects that copying and moving files have on compression.
In this exercise, you use Windows Explorer to compress files and folders to make more disk space available on your NTFS partition. You also configure Windows Explorer to display the compressed files and folders in a different color. Next, you uncompress a file. Finally, you view the effects that copying and moving files have on compressed files.
Windows XP Professional displays the Local Disk (C:) Properties dialog box with the General tab active.
What is the capacity of drive C?
What is the free space on drive C?
To create a folder on drive C, click Local Disk (C:). On the File menu, click New. Windows XP Professional creates a folder named New Folder in the root folder of the C drive. Right-click New Folder and then click Rename. Type Compressed and then press Enter.
Windows XP Professional displays the Compressed Properties dialog box with the General tab active.
Windows XP Professional displays the Advanced Attributes dialog box.
Notice that the system automatically removes the check from the Compress Contents To Save Disk Space check box.
Windows XP Professional displays the Confirm Attribute Changes dialog box, prompting you to specify whether to compress only this folder or this folder and all subfolders.
Windows XP Professional displays the Applying Attributes message box, indicating the progress of the operation and the paths and names of folders and files as they are compressed. Because there is little data on drive C, compression completes too quickly for you to view this dialog box.
Windows XP Professional displays the Compressed2 Properties dialog box with the General tab active.
Windows XP Professional displays the Advanced Attributes dialog box.
Because the Compressed2 folder is empty, Windows XP Professional does not display the Confirm Attributes Changes dialog box asking you to specify whether to uncompress only this folder or this folder and all subfolders.
What indication do you have that the Compressed2 folder is no longer compressed?
In this exercise, you see the effects that copying and moving files has on compressed files.
How can you verify that Text1 is compressed?
Is the Text1 file in the Compressed\Compressed2 folder compressed or uncompressed? Why?
Is Text1 compressed or uncompressed?
Is Text1 compressed or uncompressed? Why?
Windows XP Professional displays the Compressed Properties dialog box with the General tab active.
Windows XP Professional displays the Advanced Attributes dialog box.
Windows XP Professional displays the Confirm Attributes Changes dialog box, prompting you to specify whether to uncompress only this folder or this folder and all subfolders.
Windows XP Professional briefly displays the Applying Attributes message box. This might happen so fast that you do not see it.
In this exercise, you will create a compressed folder using the Compressed Folders feature.
Compressed Folder is an option on the New menu.
You have just created a compressed folder. Notice the zipper icon that identifies compressed folders. You can drag and drop files into the compressed folder and they will automatically be compressed. If you copy a file from the compressed folder to another that is not compressed, the file will no longer be compressed.
The following questions will help you determine whether you have learned enough to move on to the next lesson. If you have difficulty answering these questions, review the material in this lesson before beginning the next lesson. The answers are in Appendix A, "Questions and Answers."