如何使用 SSIS 脚本任务 C# 2005 或 2008 解压缩包含多个文件的文件夹? [英] How to unzip a folder with multiple files using SSIS script task C# 2005 or 2008?

查看:19
本文介绍了如何使用 SSIS 脚本任务 C# 2005 或 2008 解压缩包含多个文件的文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目要求我需要解压一些 zip 文件夹.我在谷歌上搜索并知道不使用外部库我无法实现这一点,或者使用 GzipStream 类我们可以解压缩 .gz 文件.

There is a requirement in my project that I need to unzip some zip folder. I googled and came to know without using external libraries I can not achieve this or with GzipStream class we can decompress .gz files.

有什么方法可以不使用任何外部库来解压吗?

Is there any way we can decompress without using any external libraries?

PS:我只需要为此使用脚本任务组件,.Net 框架是 3.0.

PS: I need to use only script task component for this and .Net framework is 3.0.

提前致谢.

推荐答案

A) 将变量 FileName 声明为字符串数据类型

A) Declare a variable FileName as string datatype

B) 使用 ForEach 循环遍历文件夹中的文件并将文件名映射到 FileName 变量

B) Use ForEach loop to loop through the files in the folder and map file names to FileName variable

C) 使用 Execute Process 任务压缩/解压缩到单个文件

C) Use Execute Process task to zip/unzip to individual files

D) 执行包

有关 steb 分步简短指南,请参阅 http://sqlserversolutions.blogspot.com/2008/10/zip-and-unzip-files-in-folder.html

For steb by step short guide, see http://sqlserversolutions.blogspot.com/2008/10/zip-and-unzip-files-in-folder.html

您可能还想看看这个 http://gallery.technet.microsoft.com/Unzipping-with-SSIS-Script-6b055183

这篇关于如何使用 SSIS 脚本任务 C# 2005 或 2008 解压缩包含多个文件的文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆