How to compress files in .zip with OS X and with password

enter-password-compress

On more than one occasion I have found myself in the position of having to compress files in .zip format and later having to add a security layer with a password. Most users use the format that we have mentioned in order to lower the size of a file or set of files to be able to share it.

This process is automatic in OS X and simply selecting the files to compress in .zip and accessing the conceptual menu of the right mouse button you will be able to get the packaging you need. Now OS X doesn't add a layer of password security to that .zip fileThat does not mean that we cannot do it since the system, through the Terminal, gives you the option using the necessary command. 

Compressing files in OS X is not difficult at all since you will only have to select the files or folders to compress, click on the right button of the mouse or trackpad and then click on «Compress». You will automatically get a file with the same name as the original but compressed. Keep in mind that to compress several files, what you have to do is create a folder that houses them and later compress the entire folder.

So far so good. The problem is when the user, whatever the reason, wants that .zip file to have a security layer with a password. This action can also be done by OS X but not automatically. To do this you must follow the following steps:

Have on the desktop the file or folder that you want to compress with a password.

  • Open Terminal from Launchpad or Spotlight.
  • Then you must use the following command:

zip -ejr Example.zip / file_path

In the previous command we have that Example.zip is the name that we are going to give the resulting file.

On the other hand, file_path is the path of the file to be compressed so as not to have to write it, dragging the file to the Terminal will show the path.

terminal-compress-file

  • The system then asks you to enter the password and then verify it.

folder-user-zip

  • The generated file can be found in Macintosh HD> Users> Your username

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.