Looking for a Vista Compatible Remote Control Solution?

Try Remote Control 3.2 15 Day Trial


Previous Posts


Set default printer from a script

Windows XP SP3 (Beta) Released to testers

Set IE default home page from a script

Add a new email domain to Exchange 2003

Backup your files using Remote Desktop

Force Windows 2003 to look like XP

Disable the Windows 2003 Shutdown Tracker

New SysInternals Tool: Active Directory Explorer

Can't open this item. There is not enough memory -...

Terabyte hard drives become mainstream



Archives

May 2005

January 2006

April 2006

May 2006

June 2006

July 2006

September 2006

October 2006

November 2006

December 2006

January 2007

February 2007

March 2007

April 2007

May 2007

June 2007

July 2007

August 2007

September 2007

October 2007

November 2007

December 2007

January 2008

February 2008

March 2008

April 2008

May 2008

June 2008

July 2008

August 2008

September 2008

October 2008

November 2008



Subscribe to our Feed:






Compress files automatically

If you like this article, then sign up for our email newsletter to get great Windows IT news and tips

Microsoft has included file compression with windows since Windows 2000. I am not talking about the built-in zip compression either (That actually started with XP). What I am talking about is the silent folder and file compression that works on the fly with the NTFS file system.

If you have never used it...you may have seen a folder or file in windows that looks like this (If you are using XP or 2003):

Compressed folder example


See the blue folder? The blue means the folder is compressed. Windows 2000 doesn't have any visual indicator. You can find out by going on the advanced attributes tab of the folder or file's properties...like the one below

Compressed folder example


And the "Compress this folder.." checkbox is checked, so I know that compression is turned on for this folder.

Now back to the original title of my article "Compress files automatically". I have a script that runs every night, and it generates a large log file. The log has a list of all files that I backup, and other synchronization info. Since it runs each day it can start eating up space rather quickly.

I wanted a way of compressing only the new files I created, but still leave the files in the same folder alone. This is actually very easy to do.

You can compress a file or folder by calling the compact command from the command line or a batch file. Here are all of the possible arguments for this command:

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
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.

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
parameters.


To compress my log file I simply needed to add one line to my script:

REM -Custom log generating program that I run
REM -you would have something of your own here
GenerateAccessLog.exe > %1
REM -Here is where the magic is...simply compress the specified file
REM -The specified file is the first argument supplied to the batch file
compress /c %1

Since log files compress nicely...they now only eat up 1/10th of the space.


Posted By: Steve Wiseman on Friday, August 10, 2007

Check out our utilities for windows

 



Copyright © IntelliAdmin, LLC, 2005-2009. All Rights Reserved