Win OS – Transparent File Compress Using Compact Executable

Background

There are a couple of options for on the fly file compression in MS Windows.

In this post, we will take a look at two of those options.

Processing

The options we will consider are :-

  1. Console
    • compact.exe
  2. GUI
    • MS Windows Explorer

Console

Compact.exe

Compress File

Syntax

compact /c [filename]

Sample

if not exist ..\data mkdir ..\data

set "_filename=..\data\hrdbCompressUsingCompactExe.txt"

echo f | xcopy ..\data\hrdb.txt %_filename% /D

compact /c %_filename%

Output – Image

Output – Textual

hrdbCompressUsingCompactExe.txt 241437380 : 59838464 = 4.0 to 1 [OK]

1 files within 1 directories were compressed.
241,437,380 total bytes of data are stored in 59,838,464 bytes.
The compression ratio is 4.0 to 1.

Explanation
  1. Original File Size
    • 241,437,380 bytes
    • 230 MB
  2. Compressed File Size
    • 59,838,464 bytes
    • 57 MB
  3. Compression Rate
    • 4 to 1
    • 241,437,380 / 59,838,464
      • 4.0348

Review File Compress Status

Syntax

compact [filename]

Sample

if not exist ..\data mkdir ..\data

set "_filename=..\data\hrdbCompressUsingCompactExe.txt"

compact %_filename%

Output – Image


Output – Textual
New files added to this directory will not be compressed.

241437380 : 59838464 = 4.0 to 1 C hrdbCompressUsingCompactExe.txt

Of 1 files within 1 directories
1 are compressed and 0 are not compressed.
241,437,380 total bytes of data are stored in 59,838,464 bytes.
The compression ratio is 4.0 to 1.

GUI

Windows Explorer

Compress File

Steps
  1. Launch Windows Explorer
  2. Select File
  3. Right click on the file
  4. From the drop down menu, choose the “properties” option
  5. In the Properties Window, click on the “Advanced” button
  6. In the “Advanced Attributes” property window, make sure that the “Compress Contents to save disk” option button is selected
  7. Click the OK button to exit the “Advanced Attributes” window
  8. You will be returned to the Property window, please click the “Apply” button to effect your changes
  9. Any Disk Space Savings are reflected in the  “Size” and “Size on disk” label fields.
GUI
Advanced Attributes

Properties

 

 

Highlight Compress Files

To be able to better realize compressed files, please change your file view to include the Attributes option.

 

steps

Launch Windows explorer

Navigate to the folder

click on the top bar

choose the details option

in the details window,  please choose Attributes option

 

Images
File View without Attributes Column

 

Choose Details

 

File View with Attributes Column

 

References

  1. Microsoft
    • TechNet
      • Raymond Chen
        • May 2011 > Windows Confidential: Just What Is ‘Size on
          Link

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s