Using the Compression Task

The Compression Task is an SSIS control flow task that can be used to compress or decompress a file or directory.  

The task includes the following two pages to configure what action to take.

  • General
  • Error Handling

General page

The General page of the Compression Task allows you to specify the general settings of the component. 

SSIS Compression Task


The compression task can take one of two actions: Compress or Decompress

  • Compress - Compresses a file or folder to a compressed file.  Compression is done using the ZIP archive file format.
  • Decompress - Decompress a compressed file of the ZIP archive file format to an uncompressed file or folder.
Source Type

The compression action can be applied to one of two source types: File or Directory.  It behaves differently depending on the action that has been selected.

  • Compress Action 
    • File Source Type - Compress a single file specified in the path field. 
    • Directory Source Type - Compress a directory specified in the path field and the files within it.  Check the include subdirectories checkbox to include subdirectories.
  • Decompress Action
    • File Source Type - Decompress the selected file.
Source Path

The Source Path specifies the location of a file or folder to compress when the Compress action is selected.  It specifies the compressed file to decompress when the decompress action is selected.  

When the compress action is selected and the source type is Directory, a file name containing wildcard characters * and ? may be used to only match certain files.  * represents any number of random characters and ? represents a single random character.  For example choosing to compress the directory "C:\Compression Test\Large Data File.*" would compress every file in the directory with the name "Large Data File" and any extension.  If the "Include Subdirectories" checkbox was checked the filter would also be applied to any file found in a subdirectories, but would not be applied to directories; every directory would be included.

Include Subdirectories

When compressing a directory, subdirectories can optionally be included.  If the include subdirectories checkbox is not checked only files at the root level of the specified path will be compressed.  

This option is not applicable to the decompress action.

Destination Path

When compressing a file or directory, the destination path species where the resulting compressed file will be located.  

When decompressing the destination path specifies where the resulting decompressed file or folder will be located.

Overwrite Existing Items

When compressing a file or folder, the Overwrite Existing Items checkbox determines if the resulting compressing file overwrite a file of the same name in the same location.  

When decompressing, the Overwrite Existing Items checkbox determines if the result


When compressing a file or directory, the password field allows a password to be specified which will be applied to the compressed file that is created.  The password will be required to extract files from the compressed file.  A password will not hide directory structure or file names, this is a limitation of the zip file format.  One way to hide directory structure and file names would be to use a second compression task to compress the compressed file that is created by the first task.

When decompressing the password field is used to specify a password that will be used to decompress the files.

Compression Level

When compressing a file or directory the compression level determines the strength of compression to use.  The highest the compression level the longer compression will take, but the small the resulting compressed file will be.  There are four options available for compression level:

  • None - The resulting compressed file will have not be compressed at all.  This should be used when compression is not required, just grouping several directories or files into a single archive.
  • Best Speed - The resulting compressed file will be minimally compressed, but time to compress will be the lowest.
  • Default - A mix between best speed and best compression.  Files and directories will be compressed a moderate amount and it will take a moderate amount of time.
  • Best Compression - The best available compression algorithm will be used, but time to compress will be the highest.
Temp Directory Path 

When compressing or decompressing a file or directory temporary files must be created.  The location of the temporary files can be specified using the temp directory path field.  If nothing is specified in this field temporary files will be created in the default location for the operating system.

Error Handling page

The error handling page provides options for handling errors with the compression task.

SSIS Compression Task - Error Handling

Continue On Error

Determines if the task should continue or stop when an error is encountered.