Results 1 to 4 of 4

Thread: Setting password to a zip file

  1. #1

    Thread Starter
    Hyperactive Member csKanna's Avatar
    Join Date
    Dec 2005
    Location
    Tech-Tips-Now.com
    Posts
    339

    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
    Kanna

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Setting password to a zip file

    I am not sure but it this what you are looking for?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3

    Thread Starter
    Hyperactive Member csKanna's Avatar
    Join Date
    Dec 2005
    Location
    Tech-Tips-Now.com
    Posts
    339

    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?
    Kanna

  4. #4
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    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();
    }
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width