Skip to content
Home » Create password protected zip file via command line

Create password protected zip file via command line

In this post, we will see how to password protected a zip file using command line so that even if the anyone outside gets access to that zip file, can not unzip it without providing the password.

zip -ejr <new_zip_file_name.zip> <directory_name_to_zip>
[new_zip_file_name.zip: name for the zip file to create.
directory_name_to_zip: The source directory to zip]

Example: zip -ejr folder.zip zip_folder

(encryption), ask for a password to create password protected zip file.
j (junk the path), will not include the folder hierarchy inside zip file because of zip command by default archives the complete folder hierarchy leading to your target folder.
r (recursive), will force the zip command to include the entire contents of the folder in the archive.

Leave a Reply

Your email address will not be published.

0 Shares
Tweet
Pin
Share
Share
Share
%d bloggers like this: