50

Is it possible to add a password to an existing zipfile with 7zip without going to all the trouble of unpacking it and re-packing it again?

3
  • What platform (Linux, Windows, ...) are you using?
    – Catherine
    Nov 25, 2010 at 2:14
  • @Dennis: well, if you are writing this seriously, it's sad, and if not, it's not funny anyway. (And what if I'd say that regular 7zip executable won't run on Windows 3.11?)
    – Catherine
    Nov 25, 2010 at 3:07
  • 1
    I run windows 7 and ubuntu linux 10.10, depending on what needs doing. 7zip is cross platform though so what difference does that make? Nov 25, 2010 at 16:33

4 Answers 4

41

By nature if you want the file to be encrypted, it needs to be unpacked and repacked, since the whole archive needs to be encrypted with the password.

6
  • 2
    That's the correct answer ;) - Even if a program gives you an option to add a password to a ZIP file in one single step it will internally repack all files.
    – BlaM
    Nov 27, 2010 at 15:27
  • 3
    @BlaM thanks for the clarification. Though thinking about it more carefully, the "going to all the trouble" bit is really about avoiding my trouble, not the computer's. ;-) So I'd be okay with that option, which doesn't seem to available anyway. Nov 29, 2010 at 0:20
  • 1
    I'd actually argue this isn't the correct answer because the question is about if this feature exists, not how the feature would work. @mattwilkie Apr 23, 2021 at 22:55
  • @DanielKaplan I read the phrase "by nature" as meaning "you just can't do that", which is the correct answer (albeit not what I was looking for). I suppose that could be more explicit, and now it is thanks to these comments. May 3, 2021 at 23:17
  • @mattwilkie I apologize because this is turning into a discussion of semantics so it may not be productive. That said, if 7zip wanted to, they could add a feature that, behind the scenes, unpacks and re-packs a zip file with a password. If this feature existed, explaining how to use it would be the direct answer your question. Since it doesn't exist, the direct answer to your question is, "No, this feature doesn't exist." But this answer is implementation details; it's "here's why zip files can't do this." Technically, that's irrelevant to whether or not 7zip can do this. May 5, 2021 at 20:55
17

Would it work for you to zip the zip file? Use no/low compression and encrypt the original zip file. Its a lot quicker than repacking the original files.

2
  • This is actually genius. Just do 7zip + store. It takes like 1 second per GB, and the contents get encrypted all the same. Feb 8, 2023 at 4:31
  • 1
    It results in a nested zip file. A zip file within a zip file. You'll have to extract the first zip file (encrypted), out into another zip file (original, not encrypted), and then extract that. That could be the right answer for some people if they know the tradeoff. Feb 22, 2023 at 17:46
3

You can password-protect an existing ZIP file with zipcloak.

EDIT: T. Furukawa crafted a patch for zipcloak that adds a password option, so batch processing is much easier: C:\>for %f in (*.zip) do zipcloak -p password %f.

If you prefer a GUI, both WinRAR and PeaZip can batch encrypt existing archives.

  • In WinRAR: Select ZIP files > Tools > Convert archives > Compression... > Set password...

  • In PeaZip: Select ZIP files > Convert > Enter password / keyfile (optionally set algorithm to ZipCrypto under the Advanced tab for compatibility with Windows' built-in ZIP handling)

4
  • 7
    zipcloak isn't 7zip as OP asked for :/
    – nmz787
    Nov 19, 2016 at 2:18
  • 1
    Jeez guys, this is actually by far the best answer if all you want to do is password-encrypt an existing zip. It doesn't answer exactly the question as asked, but why downvote??
    – Raman
    Oct 22, 2020 at 21:41
  • It is an interesting answer but according to the man page of zipcloak it: uses original zip encryption which is considered weak
    – JohannesB
    Aug 31, 2023 at 8:06
  • zipcloak also doesn't support large files or large archives. Nor split archives.
    – jlh
    Feb 7 at 9:45
3

Yes, you can do it with 7-Zip, following below steps without doing any extract and repacking

  1. Right click files you want to add to zip
  2. 7-Zip -> Add to archive...
  3. New window opens with default name for new zip file.
  4. Next to that drop down box, there is a square button with three dots over it (Browse)
  5. Select existing zip file into which you want to add files
  6. Over already open window, Right-Bottom there is 'Encryption' block, with text boxes to input intended password, give inputs there
  7. Click OK
  8. Congrats
4
  • 3
    This is helpful but what if you don't want to add any new files? Apr 23, 2021 at 22:53
  • @DanielKaplan of course, you just have to select and zip the files, that you want to have inside the archive.
    – winklerrr
    Aug 25, 2021 at 9:39
  • "Yes you can do it with 7-Zip IF YOU ADD A FILE TO THE ZIP FILE." If the feature exists in 7-Zip when adding files (the feature being, re-write the existing .zip file encrypted), why does it not exist when adding no files? Seems like essentially the same operation. Workaround is to add a dummy file, eg an empty this_zip_file_is_encrypted_see_superuser_214823.txt ;) right click on that and add to archive... Feb 22, 2023 at 17:52
  • No, this won't work. This is the procedure for adding a new file, encrypted, to an existing archive, but it won't encrypt files which already are in the archive. Encryption in ZIP archives is per file, NOT archive-wide. Feb 12 at 12:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .