Mac os X Zip Files with Password

On Mac os X system, we usually zip file with "right click files -> select command Compress 'xxx' ", but what if we need zip file with password to protect it? we can do it with a simple shell command, it's just piece of cake, let me show you how to do it!

 

{ 1. Open Terminal }

You can find Terminal/iTerm in you application folder, you can also use Spotlight Search here, just open it.

 

{ 2. CD To the Folder }

type in "cd " in Terminal, then drag the folder into terminal, the path will auto add, then  press "enter"

 

{ 3. Zip It } 

let's say you have A1.txt, A2.txt and B1.txt in the folder, I will show you the command.

//Single file zip
zip -e YiiLib1.zip ./A1
Enter password: //type your password twice of cause
Verify password: //type your password twice of cause


//multi files zip
zip -e YiiLib2.zip ./A1 ./B1
Enter password: //type your password twice of cause
Verify password: //type your password twice of cause


//whole folder zip
zip -er YiiLib3.zip ./
Enter password: //type your password twice of cause
Verify password: //type your password twice of cause

 

{ X. Summary }

If you want zip everything in the folder, add r to the command, that's all. Good luck for your Zip.