I've create a zip archive using the following command:

zip -e myfolder.zip myfolder/

Which prompts for a password and compresses the folder without errors. Now I'm trying to unzip the archive using this other command:

unzip myfolder.zip

which should supposedly ask for the password I set before, but doesn't - it just extracts an empty folder. I've tried using the -p mypassword option, but with the same results.

What could be the problem?

1 Answer 1


Since you did not use the -r option when creating the archive, your archive contains only the directory, and not the files inside it.

Apparently the encryption of a Zip file does not extend to protecting the directory structure, just the contents of the files. As a result, if a zip file contains only directories and no files, the encryption/decryption does nothing at all.

  • in other words I lost all my files for good?
    – gccallie
    Dec 29, 2020 at 11:48
  • Check the contents listing of your zip file: unzip -l myfolder.zip. If you have deleted the original folder, then it's lost because you never zipped its contents in the first place.
    – telcoM
    Dec 29, 2020 at 11:54
  • Today is the day that you learn to test your work. Dec 29, 2020 at 12:29

You must log in to answer this question.

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