For SSIS packages, most of the times you will get zip, rar or tar etc files and need to extract them during the extraction operation in SSIS. Let us see how we can do this directly from SSIS.
You can use the Execute Process Task in the Control Flow task. In BIDS Simply drag and drop an Execute Process task to the control flow and configure as shown below:
In the Execute Process, you need to perform three configurations:
- Executable: This is the path of the application you are going to use. This specific example has used Winrar.
- Arguments: In this you need to supply the arguments to extract the zipped files. In the particular example e stands for Extract files to current directory. Then the full path name of the zipped file. –o+ is a parameter to say overwrite files if they exist.
- Working Directory: This is the current directory for the process. In the given example test1.rar will be extracted to the directory given in the Working Directory attribute.
However, Most of the time there will be several zip files to extract and the path may not be defined this clearly. For this you can us the For Each container and include the process task inside it as shown below: In the For Each loop container, the enumerator is Foreach File Enumerator which is the default enumerator. In the Execute process task all the configurations are the same as above except the arguments were set to “e ” +@[User::currentFile] + ” -o+”. You can download the sample SSIS package here.]]>