Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Zip with Password

$
0
0
Hi,

In my shell script I am using the zip command to zip the log files. The zip file is password protected. But there is a dicey.

I want the output as:
1) All files should be zipped including sub-directories' files
2) All files (individually) should be Password protected (may be common or different)
3) User should feed the password as input just once.

Condition 1 is met. But in Condition2 the sub-directory files are not password protected.Rather the sub-directory is password protected.

I used zip -r -9 -m -P password file_name.zip *

Here password I handled in variable (condition 3) and without any interference zip command works. I tried using zip command option -e (as zip -r -e ...). But it prompts for password twice which is not recommended. Or is there any way to get the password from user as input and feed the same in run time when it prompts for Password while using -e option?

Please suggest.:confused:

Viewing all articles
Browse latest Browse all 16232

Trending Articles