This is my requirement, I need to extract files from password protected zipped files. I would like to know if there are any code snippets available. I am using SSIS to download these zipped files from an FTP. Is there any latest update to the 4.5 framework which I can make use of.
Update:
I have now referenced the file and tried out an example but now I am getting an exception, I even tried to add a breakpoint in my script task but still what I get is only an exception.
Exception:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
Snapshot:
Code:
try
{
string zipfilePath = @"C:\ZipFiles";
string zipPassword = "qwerty";
using (ZipFile zip = new ZipFile())
{
zip.Password = zipPassword;
zip.AddFile("File-01.txt");
zip.AddFile("File-02.txt");
zip.AddFile("File-03.txt");
zip.AddFile("File-04.txt");
zip.Save(zipfilePath + "AllFiles.zip");
}
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
PS: I am new to C#