Compact
This page is from Microsoft
Updated: January 21, 2005
Syntax
Parameters
Remarks
- The compact command, the command-line version of the NTFS file system compression feature, displays and alters the compression attribute of files and directories on NTFS partitions. The compression state of a directory indicates whether files added to the directory will be automatically compressed. When you set the compression state of a directory you do not necessarily change the compression state of files that are already there.
- You cannot use compact to read, write, or mount volumes that have been compressed using DriveSpace or DoubleSpace.
- You cannot use compact to compress file allocation table (FAT) or FAT32 partitions.
Examples
compact /c /s
To set the compression state of files in the current folder, subfolders in the current folder, and files within all subfolders without altering the compression state of the current folder, from the current folder, type:
compact /c /s *.*
To compress a volume, from the root folder of the volume, type:
compact /c /i /s:\
This example sets the compression state of the root folder and all folders on the volume and compresses every file on the volume. By using the /i parameter, you ensure that error messages do not interrupt the compression process.
To compress all files that end in .bmp in the \Tmp directory and all subdirectories of \Tmp, but not modify the compressed attribute of these directories, type:
compact /c /s:\tmp *.bmp
To force complete compression of the file Zebra.bmp, which was partially compressed at the time of a system crash, type:
compact /c /f zebra.bmp
To remove the compressed attribute from the directory C:\Tmp, but not change the compression state of any files in that directory, type:
compact /u c:\tmp
Formatting legend
Format | Meaning |
Italic | Information that the user must supply |
Bold | Elements that the user must type exactly as shown |
Ellipsis (...) | Parameter that can be repeated several times in a command line |
Between brackets ([]) | Optional items |
Between braces ({}); choices separated by pipe (|). Example: {even|odd} | Set of choices from which the user must choose only one |
Courier font | Code or program output |