SSIS Zip File Task (GZip,Zip,Unzip)
PreviousNext

SSIS Zip File Task can compress or uncompress (Unzip) file in Zip or Gzip format. It supports many advanced options including multi-threads.

Download SSIS PowerPack

Content

Video Tutorial

Coming soon...

Step-By-Step

In this tutorial we will learn how to generate Zip or GZip format file using ZS Compression Task. These utilities take a large number of files, save them together in an archive, and compresses the archive to save space.
  1. Firstly, You need to Download and Install SSIS ZappySys PowerPack.
  2. Once you finished first step, Open Visual Studio and Create New SSIS Package Project.
  3. In Visual Studio, drag and drop the ZS Compression Task from SSIS Toolbox.
    SSIS Zip File Task - Gzip, Unzip, Compress multiple files and folders
  4. Let's first Create a Variable for Access Target Path through Variable value.
    SSIS Zip File Task - Gzip, Unzip, Compress multiple files and folders
  5. Now, Double click on Compression Task for configure it.
  6. Let's set properties in Compression Task as we have upload below image. Select Target Path from Variable and Hit On OK Button.
    Note: If you want to operation with multiple files then use wildcard pattern as below (when you use wildcard pattern in source path then system will treat target path as folder regardless you end with slash).
    Examples:
    c:\data\file123.txt (single file) c:\data\file*.txt (all files starting with file) c:\data\subfolder\*.txt (all the files with Extension txt and located under folder subfolder)
    SSIS Zip File Task - Gzip, Unzip, Compress multiple files and folders
  7. After all, You can Execute Task and See Information in Execution Results.
    SSIS Zip File Task - Execute
  8. For more Inform related Compression Task, Please check out our Blogs we have for ZS Compression Task.

Properties

Property Name Description
Action Specifies what action you want to perform

Available Options (Use numeric value listed in bracket if you have to define expression on this property (for dynamic behavior).

Option Description
CompressAsSingle [0] Compress File(s) - Create single archive (one for all)
CompressAsMulti [1] Compress File(s) - Create multiple archives (one for each)
Uncompress [2] Uncompress File(s)
CompressAsSingleWithFolderStructure [3] Compress Files - With folder structure
SourcePathAccessMode Path access mode for file/folder

Available Options (Use numeric value listed in bracket if you have to define expression on this property (for dynamic behavior).

Option Description
Direct [0] Direct
Variable [1] Variable
Connection [2] Connection
SourcePathValue Source path or pattern
SourcePathConnection Connection name which holds source path
SourcePathVariable Variable name which holds source path/pattern
Recursive Specifies how to handle scanning of items
TargetPathAccessMode Path access mode for file/folder

Available Options (Use numeric value listed in bracket if you have to define expression on this property (for dynamic behavior).

Option Description
Direct [0] Direct
Variable [1] Variable
Connection [2] Connection
TargetPathValue Specifies target path
TargetPathConnection Specifies target path
TargetPathVariable Specifies target path
OverwriteAction Specifies how to handle overwrite action

Available Options (Use numeric value listed in bracket if you have to define expression on this property (for dynamic behavior).

Option Description
ThrowException [0] ThrowException
SkipAll [1] SkipAll
OverwriteAll [2] OverwriteAll
OverwriteOlder [3] OverwriteOlder
OverwriteDifferentSize [4] OverwriteDifferentSize
ResumeIfPossible [5] ResumeIfPossible
Rename [6] Rename
OverwriteDifferentChecksum [7] OverwriteDifferentChecksum
ArchiveFormat Compression file format

Available Options (Use numeric value listed in bracket if you have to define expression on this property (for dynamic behavior).

Option Description
Zip [0] Zip
GZip [1] GZip
CreateMissingTargetFolder Specify this option if you want to create target folder automatically if its missing
EncryptionAlgorithm Specifies the encryption algorithm used to encrypt data.

Available Options (Use numeric value listed in bracket if you have to define expression on this property (for dynamic behavior).

Option Description
None [0] No encryption
Unknown [1] Unknown encryption algorithm
Aes128 [2] AES 128 bit encryption
Aes192 [3] AES 192 bit encryption
Aes256 [4] AES 256 bit encryption
Zip20 [5] Traditional PKWARE encryption (Considered as weak)
CompressionLevel Gets or sets the compression level to be used by Add(String) and AddFile(String) methods. Pick right option to balance speed vs size. For example FastCompression can reduce time to compress but wont give you good compression ration. On the other end BestCompression will give you high compression ration but will take longer to compress. Choose right setting based on your need.

Available Options (Use numeric value listed in bracket if you have to define expression on this property (for dynamic behavior).

Option Description
NoCompress [0] No compression, but very fast
FastCompress [1] The fastest compression, but the worst compression ratio
DefaultCompress [6] Default compression, a compromise between speed and compression ratio
BestCompress [9] Best compression ratio, but the slowest
LocalHeaderVerificationMode Gets or sets the compression header verification mode. Change this to None (Do not verify) if you have malformed Zip file and you like to continue operation without failing.

Available Options (Use numeric value listed in bracket if you have to define expression on this property (for dynamic behavior).

Option Description
Default [0] Default
None [1] Do not verify header
Crc [2] Verify Just CRC field
CompressedLength [3] Verify Just Compressed Length
UncompressedLength [4] Verify Just UnCompressed Length
All [5] Verify All fields
CompressionMethod Compression method to be used

Available Options (Use numeric value listed in bracket if you have to define expression on this property (for dynamic behavior).

Option Description
NoCompression [0] None - Uncompressed
Deflate [1] Deflated
EnhancedDeflate [2] Enhanced deflate (compatible with Deflate64(tm) by PKWARE)
Comment Comment for the whole ZIP archive
Password Specifies the encryption algorithm used to encrypt data.
ParallelThreads Sets the number of parallel compressors to use when compressing data. Multiple compressors take advantage of modern multi-core CPUs and substantially enhance compression speed.
ExcludeRegXPattern Regular expression pattern to exclude items from selection  (if you apply MyFile*.* filter for source path and then use ExcludeRegXPattern=(\.msi$|\.exe$) then it will include all files with matching name but exclude *.msi and *.exe
IncludeRegXPattern Regular expression pattern to include items from selection (if you apply MyFile*.* filter for source path and then use IncludeRegXPattern=(\.txt$|\.csv$) then it will include only txt and csv files with matching name pattern
TreatRegXForFullPath Treat include/exclude Regular Expression as Full Path expression rather than file name. If you have a use case of checking against Folder name pattern along with file name then use this option. When you check this option then using ^ in the front of expression will not work for File name pattern so instead of something like this ^MyFile\w+\.csv$ you need to change prefix check like this  [\\|/]MyFile\w+\.csv$ this way it works against full path check.
SortBy Property by which you want to sort result

Available Options (Use numeric value listed in bracket if you have to define expression on this property (for dynamic behavior).

Option Description
Size [0] File Size in Bytes
LastModifiedDate [1] File Last Modified DateTime
CreationDate [2] File Creation DateTime
AgeInDays [3] File Age in Days
LastEditInDays [4] Last Edit in Days
Content [5] File Content
Exists [6] File Exists Flag
FileCount [7] File Count
FolderPath [8] File Directory Path
FilePath [9] File Path
FileName [10] File Name
FileExtension [11] File Extension
FileEncoding [12] File Encoding
IsLocked [13] Is File Locked
SortDirection Sort order (e.g. Ascending or Descending)

Available Options (Use numeric value listed in bracket if you have to define expression on this property (for dynamic behavior).

Option Description
Asc [0] Asc
Desc [1] Desc
WhereClause Where clause expression to filter items. (e.g. Size>100 and Extension IN ('.txt','.csv') )
EnableSort Sort items by specified attribute
MaxItems Maximum items to return (e.g. TOP)
SkipItems Maximum items to skip (e.g. SKIP)
LoggingMode

Available Options (Use numeric value listed in bracket if you have to define expression on this property (for dynamic behavior).

Option Description
Normal [0] Normal
Medium [1] Medium
Detailed [2] Detailed
Debugging [3] Debugging
PrefixTimestamp When you enable this property it will prefix timestamp before Log messages.

Setting UI

SSIS Zip File Task - Gzip, Unzip, Compress Setting UI
SSIS Zip File Task - Gzip, Unzip, Compress Setting UI

See Also

Articles / Tutorials

Click here to see all articles for [SSIS Zip File Task] category
SSIS Zip File Task – Compress files and password protect

SSIS Zip File Task – Compress files and password protect

Introduction In this blog post we will see how to compress files and encrypt with password (zip and encrypt using AES algorithm). We will use SSIS Zip File Task which comes with many advanced options including encryption feature for password protected zip files. NOTE: Password feature is only available for Zip file format. If you […]



Copyrights reserved. ZappySys LLC.