How to extract a password protected zip file using DotNetZip in C# and VB.NET

To extract (unzip) a password protected zip file using the Ionic DotNetZip Library, you can use the snippet below.

Samples

[tab name=”C# Sample”]

[/tab]
[tab name=”VB.NET Sample”]

[/tab]

[end_tabset]

If you have any questions or suggestions feel free to rate this snippet, post a comment or Contact Us via Email.

Related links:

Please rate this snippet

How to unzip a zip file in python

To unzip a zip file in python you can use the following snippet.

Sample Python

import zipfile
myZip = zipfile.ZipFile('myArchive.zip','r')
for zipContentFile in myZip.namelist():
    data = myZip.read(zipContentFile)
    file = open(zipContentFile, 'w+b')
    file.write(data)
    file.close()

for more informations see Work with ZIP archives¶

Please rate this snippet

How to unzip a zip file in PHP

To unzip a zip file in PHP you can use the following snippet.

Sample PHP

function Unzip($filename, $destination){
	$zip = new ZipArchive() ;
	if ($zip->open($filename) !== TRUE) {
		die ('Could not open archive file');
	}
	$zip->extractTo($destination);
	$zip->close();
	echo 'Archive successfully extracted to directory';
}

Please rate this snippet