I want to compress all files in a directory and protect the zip file with password.
We can do it without installing third party software on Mac OSX like 7zip, iZip, etc.
Step 1: Prepare all files in 1 directory
Step 2: Open Mac terminal and Run ‘zip’ command on mac terminal
Go to the path which contains directory / files. In this case, I want to compress a directory inside:
Then run this command on mac terminal:
zip -erj [filename].zip [directory_to_compress]
-e is to encrypt all files using password;
-r perform compression recursively to all files;
-j remove all internal directory. So the zip file will not store the full path (relative to the current directory).
zip -erj compressed_file.zip /Users/rajadavid/Desktop/compress
Step 3: Type the password in terminal twice
The compressed file with password protected will be available in: