简体   繁体   English

如何在没有第三方应用程序的情况下使用 SSIS 脚本任务解压缩受密码保护的文件?

[英]How to unzip password-protected files using SSIS script task without third-party app?

I want to unzip and extract from a password-protected file using SSIS.我想使用 SSIS 从受密码保护的文件中解压缩和提取。 I do not want to use any third-party applications and therefore I used script task.我不想使用任何第三方应用程序,因此我使用了脚本任务。 I am able to extract if there is no password on the file, however, don't know about password parameter in the same.如果文件上没有密码,我可以提取,但是,不知道密码参数是否相同。

I am using the .NET 4.5 framework, with System.IO.Compression and System.IO.Compression.FileSystem, System.IO references added.我正在使用 .NET 4.5 框架,添加了 System.IO.Compression 和 System.IO.Compression.FileSystem,System.IO 引用。

This is what works without password:这是没有密码的作品:

            string ZipFullPath = Dts.Variables["User::FullPathtoZip"].Value.ToString();
            string inputfolder = Dts.Variables["User::TargetFolder"].Value.ToString();

            using (ZipArchive arch = ZipFile.OpenRead(ZipFullPath))
            {
           
                foreach(ZipArchiveEntry entry in arch.Entries)
                {
                    entry.ExtractToFile(Path.Combine(inputfolder, entry.FullName));
                    
                }
            }

            File.Delete(ZipFullPath);

Can someone please tell me how I can add a password parameter to the same?有人可以告诉我如何添加密码参数吗? New to C#. C# 新手。

You have to use a well known 3rd party library, Like as DotNetZip .您必须使用众所周知的 3rd 方库,例如DotNetZip Also, you can get details discussion from Zip Decompressing此外,您可以从Zip Decompressing获得详细讨论

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM