|
-
May 17th, 2011, 01:24 AM
#1
Thread Starter
Hyperactive Member
Setting password to a zip file
Hi,
I have an existing zip file. I would like to set a password to my existing zip file. I know how to zip, unzip using SharpZipLib. I am wondering, Is there a way to set a password without extracting and re-creating the zip file with password?
Let me know.
Thanks
-
May 17th, 2011, 02:58 AM
#2
Re: Setting password to a zip file
I am not sure but it this what you are looking for?
-
May 17th, 2011, 09:28 PM
#3
Thread Starter
Hyperactive Member
Re: Setting password to a zip file
I know that already. As i said in my OP, i know how to extract and rezip the files with password. What i am looking for is, is there anyway to set the password for existing zip file without extracting it?
-
May 18th, 2011, 01:19 AM
#4
Re: Setting password to a zip file
I thought but cannot test it may work by modifying the sample code in the link like this.
Code:
using ICSharpCode.SharpZipLib.Zip;
public void UpdateExistingZip() {
ZipFile zipFile = new ZipFile(@"c:\temp\existing.zip");
// Must call BeginUpdate to start, and CommitUpdate at the end.
zipFile.BeginUpdate();
zipFile.Password = "whatever"; // Only if a password is wanted on the new entry
// Both CommitUpdate and Close must be called.
zipFile.CommitUpdate();
zipFile.Close();
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|