Previous section   Next section

COMPRESSION COMMANDS

Each file in the Windows Server 2003 NTFS file system contains a compression attribute that indicates either that the file should be stored as compressed or is already compressed. Compression is recommended for large files that are used infrequently. When this attribute is selected, files are automatically compressed when they are saved and decompressed when accessed for use. (Remember that this compression technology is not available with the FAT file system.)

The compression attribute can be set from within the My Computer windows or through Windows Server 2003 Explorer. From Explorer, select the file you wish to view or set the compression attribute. Next, select from the menu bar File Properties. In the Properties window, select the General tab if it is not already displayed. On the General tab, select Advanced. In the Attributes box, check the Compress Contents to Save Space box to compress or decompress a file.

As an alternative to the menu bar, you can right-click the file and, from the menu that appears, select Properties.

compact Command

The compact command allows the user to set or display the compression attribute on NTFS files from the command line. Its syntax is

compact [options] [filename]

The file name parameter can actually be the name of a file or a directory. In a directory, the compression attribute indicates that any new files added to it will automatically have their compression attributes set and they will be compressed. This does not change the compression attribute for files that already exist in the directory. For them, wildcard characters can be used as part of the file parameter.

If no options are used or no file names are entered, the compression attribute for the current directory is displayed. See options list in Table A.28.

To set the compression attribute on the directory \ellen\oldfiles as well as any of its subdirectories, enter the following:

compact /c /s c:\ellen\oldfiles

To remove the compression attribute from the directory d:\bob\contracts, enter

compact /u d:\bob\contracts

Remember, the above command will only remove the attribute from the directory and will not affect any of the files and subdirectories currently in the directory \bob\contracts.

Table A.28. compact Options

Option

Qualifier

Description

/c

 

Compresses the named file(s).

/u

 

Decompresses the named file(s).

/s

:directory

Compresses or decompresses all subdirectories for the identified directory. The :directory qualifier is optional. The default is the current directory.

/i

 

Ignores any errors that occur.

/a

 

Displays hidden or system files. These will be omitted by default.

/f

 

Forces file name to be compressed or decompressed. The main use for this option occurs when a file was only partially compressed or decompressed and the system administrator needs to complete the task.

Table A.29. expand Command Options

Option

Qualifier

Description

-d

 

Displays a list of files in the source volume.

-f:

filename

Specifies a file.

-r

 

Renames the expanded file.

expand Command

The expand command is used to decompress one or more files as well as to retrieve files from a distribution disk. Its syntax is

expand [-r] source [destination]

Table A.29 lists the options for the expand command.


  Previous section   Next section
Top