COMPACT: This command Displays or alters the compression of files on NTFS partitions or marked that folder so files which added later on will be compressed/Uncompressed automatically .
Switches:
/C Compresses the specified files and Directories will be marked so files which added later on will be compressed automatically.
/U Uncompresses the specified files. Directories will be marked so files which added later on will not be compressed.
/S Performs the specified operation on files in the given directory and all subdirectories. Default “dir” is the current directory.
/A Displays files with the hidden or system attributes. These files are omitted by default.
/I Continues performing the specified operation even after errors have occurred. By default, COMPACT stops when an error is encountered.
/F Forces the compress operation on all specified files, even those which are already compressed. Already-compressed files are skipped by default.
/Q Reports only the most essential information.
filename Specifies a pattern, file, or directory.
Running compact command without any switches will displays the compression state of the current directory and any files it contains. You may use multiple
filenames and wildcards.
Note:
The compact command is the command line version of the NTFS file system compression feature. The compression state of a directory indicates whether files are automatically compressed when they are added to the directory. Setting the compression state of a directory does not necessarily change the compression state of files that are already in the directory.
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.
Example:
Compact /c /a /i *
This command will compress current folder and will display all files with the hidden or system attributes and continue the operation even after errors have occured.
Compact /u /a /i *
This command will uncompress current folder and will display all files with the hidden or system attributes and continue the operation even after errors have occured.