Hopefully helps someone else:. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Ask Question. Asked 8 years ago. Active 4 years, 10 months ago. Viewed 19k times. Is there any way we can decompress without using any external libraries? PS: I need to use only script task component for this and.
Net framework is 3. Thanks in advance. Stuart 1 1 gold badge 11 11 silver badges 35 35 bronze badges. Ishan Trikha Ishan Trikha 5 5 gold badges 6 6 silver badges 13 13 bronze badges. Add a comment. Active Oldest Votes. SSIS variables needed to do the job. This foreach loop container finds all zip files.
In the Foreach Loop Editor, select Collection in the left pane. As we want to make the solution generic by using all those parameters mentioned above, we have to add a few expressions. Foreach Loop container Collection configuration. Add the following three expressions in my opinion the editor is not very userfriendly, the window is too small, but it can be done :.
Please note that these expressions will set the values for Folder , Files and the Traverse subfolders checkbox in the Enumerator configuration part of the screen inside the purple square in the picture above. If you close and reopen the Foreach Loop Editor, you will notice that the configuration fields now use the values from the corresponding parameters, except the value Fully qualified for Retrieve file name , which is hardcoded.
Example of how to set an expression.. Variable Mappings. The next nifty thing that needs to be done, is creating a folder to store the unzipped files. As we do not know if zipped files with the same name exist in multiple zip files, the safest thing to do is to create a directory structure identical to the directory structure of the zip files. Additionally, the basename of the zip file so without file extension is used as an extra subfolder. In this way we are sure that unzipped files with the same name can be stored without overwriting other ones.
Open the Expression Task and paste this expression into the Expression textbox. Then press the Evaluate Expression button to check that the expression is valid. Configuring the Expression Task. In the previous step we have composed the full path to unzip files into, but this folder structure might not exist yet. The good news is that the File System Task can create multiple sub folders at once. Configure it as shown in the picture. The funny thing is, that in the Process pane, you do not have to change anything.
Executable and Arguments are set using expressions coming next and all the other properties can keep their default values. Process configuration. Setting Executable and Arguments using expressions Arguments copy-friendly :. There is one problem with the steps done so far. If a zipfile does not contain a file that matches the FilenamePattern , then the folderstructure is made for nothing.
However you could just leave these empty folders, I think the solution is a bit better if these empty folders are deleted. Please note that you can download the C script here. Here is the Step by Step process 1.
Drag and drop the Execute Process Task to the design pane. This task executes any process file. In this tip we will execute the 7z. Double click on it and click the process Tab. In this case the 7z. The WorkingDirectory is the path where the Destination folder.
0コメント