Thomas A Reed wrote:
zip -e /path/to/archive.zip /path/to/original/file/or/folder
Of course, you'd want to replace those paths with something more appropriate.
Can you like give me more details I can't understand what stuff I should change to the real thing and what stuff should I keep.
So let's say
file name: cool.zip
Drive: Macintosh HD
I hope you can just give me the exact path for the information above so it can work thanks again.
Well, first, there are a couple caveats. If you want to compress your home folder into an encrypted .zip file, you wouldn't want to place that .zip file on the desktop. There could be problems with trying to put the .zip file inside the folder you are zipping! I would put it at the root level of the hard drive instead. Second, if this is something you want to do regularly, as a means for creating an encrypted backup of the home folder or something similar, this isn't a very efficient or easy method. Creating such a large .zip file will take a long time, and it will have to be re-created from scratch every time you want to update the backup. It would be better to use a specific tool for that task.
However, all that said, to create a zip archive named cool.zip at the root level of the hard drive, containing the entire home folder, you would execute the following command:
zip -e /cool.zip /Users/yourusername
You should also be able to substitute '~' for your home folder path:
zip -e /cool.zip ~
If you wanted to create an archive of your Documents folder and place it on the desktop, to give another example, here's the command you would use:
zip -e ~/Desktop/cool.zip ~/Documents
Hope all that helps!
One tip to using Terminal. You can drag files and folders to it and they will be entered automatically. This saves a lot of long typing and tricky coding where you have names with spaces that Terminal would normally interpret as parts of command sequences. So, if I want to copy File1 to Folder2 I could type:
put a space after it.
Drag File1 to Terminal. It will automatically put a space after it, then drag folder2 to Terminal. I end up with
cp[space][File to copy with full path][space][Destination folder with full path]
Hit return to execute the command.
If you don't need to use the .zip format specifically, you can create a compressed encrypted disk image with Disk Utility, and then use that as a secure medium for transferring or storing your files. This option will interface better with OS X, but will be specific to OS X so will not be the best if you need to use the files with Windows or Linux.
They're telling you to encrypt because they're assuming that you want to protect the data from unauthorized access. A password with no prtection is like putting a Do Not Enter sign on an unlocked door; it only keeps out the sort of people who wouldn't enter without asking in the first place.
Now, if what you want is to keep your technilogically illiterate grandmother from accidently stumbling across your pr0n, then a password is good enough. Otherwise, you probably want to look at encryption.
There are applications that will let you do either one, such as Espionage2 (who actually include the Grandma scenario in their sales pitch...but not the pr0n) and Knox. But they do cost money. Or, there's the methods referred to by the other posters. Surprisingly (or not) just plain old password protection without encryption isn't that common; it's actually hard to come by.
And finally, unless the password protection is actually provided by the application making the file (as with some Microsoft Office products) you will have to password protect the folder in which you put the file. You can't just add passwords to random files.
We are talking about encryption because you asked about adding a password to a zip file, and that means encryption. Sometimes passwords may be requested that don't involve encryption, but that is not the case with zip files.
However, now that you mention a little more about what you're trying to achieve, a zip file isn't appropriate at all. To protect a video, you'd have to create an encrypted zip file with the movie in it, then delete the original movie file. To watch it again, you'd have to decompress the zip file. Clunky.
Who are you trying to protect this video from? If you just want other users of the computer to not be able to see it, create a different user account for other people and keep yours locked up. Log out when you're done, and don't give the other users your password. That's not strong protection - there are ways for a tech-savvy person with physical access to the computer, especially if they have access to an admin account on the computer, to get around that - but it works against casual intrusion.
If you want something stronger than that, you need encryption. You'd probably do better to create an encrypted disk image in Disk Utility and then copy the video into that. I've never done that, though... it's possible the encryption might cause some playback issues. Or not. You'd have to try it and see.
Thanks for the insight in encrypotolgy , Its seems a bit over my head and my available time.
Nevertheless I have tried to zip a file in to an encrypted zip file.
zip -e /cool.zip ~/Documents/Folder/File.doc
The output is, when I try to decompress the file i get.
Unable to Unarchive "cool.zip" in to "Machintosh HD".
(Error 1 - Operation not permitted.)
the comment in the terminal after command ran is.
adding: Users/LC/Documents/Folder/File(deflated 40%)
Any ideas that could help?
All the best
Mac OSX 10.6.8