To Future Me,
So here I am assembling some semi-private documents on my MAC. To be a nice person, I figured I should ZIP up the files to save a little bandwidth, as my plan is to email this bundle to a contact. Not a problem because OS X has a built in archive tool. Just right click (ctrl click) the folder of files and choose make archive from the list. Voila, a ZIP file!
To be an even nicer person, I figured I should add a thin layer of protection to the ZIP file with a password. Hmm... how the heck do you do that in OS X? No options are presented when you use the context menu. A quick Google search turned up Stuffit, which is a bloated bit of software for what I am actually trying to do. Rather than waste time, I turned to the trusty command line.
Since zip is built into Linux, it should be hanging out waiting for something to do. Sure enough, a quick command does the job. Let's look at it.
# zip -re zipped-me.zip zip-me/
The above command does the following:
- run ZIP at the command line
- -r means go through the target folder recursively
- -e tells ZIP to encrypt the final zip file. In this case that file is "zipped-me.zip"
- zipped-me.zip is the archive that ZIP will make
- zip-me/ is the folder with which I will make my archive
- during the archive process, ZIP will ask for a password. Provide it twice and you are done!
Run the following command in the terminal if your archive utility won't recognize the password. Which the default setup fails at.
# unzip zipped-me.zip
Obviously replace the name in the above command with the proper file name.
Note: If you are not using the awesome and free Unarchiver Utility instead of the default setup, you should be!
Note 2: I'm throwing in the usual caveat here. If you DO NOT know where the command line is located in OS X, or it scares you, this article has nothing of value for you. If you choose to use the above command, we can't be held responsible for any damage, loss, corruption, etc... of your files, pictures of kittens, or anything else. This is advice on the internet. Use at your own risk.