Windows NT NTFS Directory Compression

by Wayne Maples [Published on 20 April 2004 / Last Updated on 20 April 2004]

Compression utilities were once big sellers to PC users. At that time, the utility would compress at a partition level. The BIG downside was that a minor corruption could result in the loss of all data on the partition. You don't see these add-ons much anymore. Partly because large hard drives are cheap and partly because of too many failures.

Microsoft shipped NT4 with directory level compression for partitions formatted with the NTFS. If you need to free up space, I have seen very few problems. Its a good solution. It can actually speedup access of data files. If you are interested in trying this, I recommend compressing data directories and not compressing directories containing many executables.

To compess a directory (or partition):

  • Start Explorer
  • Right-click the directory
  • Select Properties
  • Check the Compress option
  • Click Apply and Explorer gives you the option to apply the compression subdirectories by checking the Also compress subdirectories
You can undo the compress up unchecking the Compress option.

If you have the Windows NT Resource Kit, it includes compact.exe which you can use from the commandline to view or change the compression of individual files and/or directories.

compact /? gives the following help listing:

Displays or alters the compression of files on NTFS partitions.

COMPACT [/C | /U] [/S[:dir]] [/A] [/I] [/F] [/Q] [filename [...]]

  /C        Compresses the specified files.  Directories will be marked
            so that files added afterward will be compressed.
  /U        Uncompresses the specified files.  Directories will be marked
            so that files added afterward 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
  /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.

  Used without parameters, COMPACT displays the compression state of
  the current directory and any files it contains. You may use multiple
  filenames and wildcards.  You must put spaces between multiple

If I want to compress a large data file, bigfile.txt, the command would be:

compact /c bigfile.txt

If you try compression on an NTFS partition and get the error message:

The file system does not support compression.

You will get this error if NTFS partition has very large cluster sizes, that is, greater than 4096. Chkdsk will give you the cluster size (it calls it allocation unit) at the end of its listing. There is no dynamic, inplace solution. Backup. Format the partition using the /a:4096 . This issue is discussed in q171892 .

NTFS Tips:

Managing Shared Resources and Resource Security
Choosing Between FAT and NTFS
Web versus NTFS Permissions
Getting the Most from IIS Security
NTFS Security, Part 2: Implementing NTFS Special Permissions on Your Web Site
Getting the Most from IIS Security
NTFS Permissions
Cancel an NTFS conversion
NT equivalents of NetWare Rights
Access NTFS from DOS, Win95 or Win98 using NTFSDOS driver
NTFS Last Access TimeStamp
xcopy - keep attributes
How To Remove Files with Reserved Names such as LPT1 or PRN
NTFS Metadata files
Disable NTs 8.3 aliases for LFNs under NTFS
Streams displays which NTFS files have alternate streams content
VolumeID changes NT and FAT volume IDs
Create a NTFS partition over 4GB during installation
Windows NT NTFS Directory Compression

See Also

See Also

Featured Links