One of the advantages of
using NTFS is the file compression feature that it includes. Using file
compression means that you can store more information on a single hard
drive. In addition, due to the manner in which hard drives work, you can
experience a small performance gain by using compression (compaction).
This utility uses the following syntax:
COMPACT [/C | /U] [/S[:dir]] [/A] [/I] [/F] [/Q] [filename [...]]
The following list describes each of the command line arguments.
/C
Compresses the
specified files or directories. Using this command line switch on a
directory marks it so that the system automatically compresses any files
added afterward.
/U
Uncompresses
the specified files or directories. Using this command line switch on a
directory marks it so that the system doesn't compress any files added
afterward.
/S[:
dir]Performs the specified
tasks on the current directory or the directory included as an argument
and all subdirectories. The default is the current directory.
/A
Forces the system
to work with files (compress, uncompress, or query) that have the hidden
or system attributes. Normally, the system skips files with these
attributes.
/I
Forces Compact to
continue performing tasks even after it experiences an error. Normally,
Compact stops performing tasks when it encounters an error. Using this
command line switch allows a batch file to continue processing files,
even when some of the files failed to react as anticipated. You should
redirect the output to a log file when using this option to track the
errors and take any required remedial action when the task completes.
/F
Forces the
compression operation on all specified objects, even those that the
system has already compressed. Normally, the system skips any files that
are already compressed. You may have to use this switch when working
with files in some instances.
/Q
Reports only essential information such as errors, rather than general information including success messages.
filename
Specifies the file
or directory name to work with. You can use all of the standard wildcard
combinations to specify multiple files or directories.
When used by itself, the Compact utility displays the current compaction state of files in the current directory, as shown in Figure 1.
You can supply a directory without any other arguments to see the
compaction state of files in other directories. The utility shows all
compacted files with a C; all normal files have a space in place of the C.
In addition to the compaction state, the standard output includes the
actual file size, the compacted file size, and the compaction ratio.
Unlike other utilities, Compact doesn't use a tabular format—each line
contains a continuous entry that shows the information used to determine
the compaction ratio. The bottom of the display shows the statistics
for the directory including the number of compacted files, the actual
and compacted size of all of the files, and the compaction ratio for the
directory as a whole.