Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help
NTFS Compression Utility\windows\system32\compact.exe

View or configure the automatic file compression on NTFS drives.

To Open

Command Prompt compact

Usage

compact [/c | /u] [/s[:dir]] [/a] [/i] [/f] [/q] [filename]

Description

One of the features of the NTFS filesystem (see FAT to NTFS Conversion Utility, earlier in this chapter) is its support for automatic compression of individual files; older files can be optionally compressed to take up less disk space at the expense of speed to access them.

Right-click on any file or folder, select Properties, and then click the Advanced button. The "Compress contents to save disk space" option is used to instruct Windows to compress the selected item. If a folder is selected, all of its contents will be compressed (you'll be prompted about any subfolders); furthermore any files added to that folder will be automatically compressed as well.

The NTFS Compression Utility is the command-line equivalent of this setting, useful for automating the compression or decompression of several files with the help of a WSH script or batch file. The NTFS Compression Utility takes the following options:


filename

Specifies a file, folder, or group of files (using wildcards) to compress or uncompress.


/c

Compresses the specified file(s). If a folder is specified for filename, the folder will be marked so that subsequent files added to the folder will be compressed automatically. Include the /s parameter to compress files already in the folder.


/u

Uncompresses the specified file(s). If a folder is specified for filename, the folder will be marked so that subsequent files added to the folder will not be compressed automatically. Include the /s parameter to uncompress files already in the folder.


/s

If a folder is specified for filename, the /c and /u parameters will act only on new files added to the folder. Include the /s parameter as well to compress or uncompress files already in the folder. If filename is omitted, use the /s option to act on all files in the current folder.


/a

Includes files with hidden or system attributes set; otherwise, ignored by compact.exe.


/i

Ignores errors; otherwise, compact.exe will stop when the first errors are encountered.


/f

Forces compression on all specified files; otherwise, files that are already compressed will be skipped.


/q

Quiet mode; use this option to report only the most essential information.

If you run the NTFS Compression Utility without any options, it will display the compression settings for the current directory and all of its contents.

Notes

  • This type of file compression is supported on NTFS drives only. If you wish to compress files on a non-NTFS drive, you can either upgrade to NTFS or use a third-party compression utility (such as WinZip).

  • Go to Control Panel [Appearance and Themes] Folder Options View tab and turn on the "Show encrypted or compressed NTFS files in color" option to visually differentiate such files from unencrypted, uncompressed files.

  • For tangible proof that a given folder or file is actually compressed, right-click on it in Explorer and select Properties. If the "Size on disk" value is less than the "Size" value, then the item is compressed.

See Also

FAT to NTFS Conversion Utility, "Compress old files" in Disk Cleanup, NTFS Encryption Utility

  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint