I want to create a ZIP file which is password protected.

How to do it using Rebex ZIP?

Applies to: Rebex ZIP

asked 12 Oct '10, 17:07

Rebex%20KB's gravatar image

Rebex KB ♦♦
3991753
accept rate: 58%


Following C# code shows how to create a password protected ZIP file and add files to it.

// create new ZIP archive 
using (ZipArchive zip = new ZipArchive(@"C:\archive.zip", ArchiveOpenMode.Create))
{
    // set the Password first 
    zip.Password = "PASSword#123";

    // now add all files from the folder c:\data
    zip.Add(@"C:\Data");
}
link

answered 12 Oct '10, 17:09

Rebex%20KB's gravatar image

Rebex KB ♦♦
3991753
accept rate: 58%

Following VB.NET code shows how to create a password protected ZIP file and ad files to it.

' create new ZIP archive 
Using zip As New ZipArchive("C:\archive.zip", ArchiveOpenMode.Create)
    ' set the Password first 
    zip.Password = "PASSword#123"

    ' now add files from the folder c:\data
    zip.Add("C:\Data")
End Using 
link

answered 12 Oct '10, 17:10

Rebex%20KB's gravatar image

Rebex KB ♦♦
3991753
accept rate: 58%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×26
×15
×4
×4

Asked: 12 Oct '10, 17:07

Seen: 3,277 times

Last updated: 12 Oct '10, 17:10