How can I compress two folders into archive file (zip, gzip or something like that) with a password on the files?
For example I have folder structure:
- rootDir
- dir1
- dir2
- dir3
- dir4
I need bash command to add dir2 and dir4 to same archive file compressed with a password on it.
Best Answer
The
zip
command is widely available; if not on your system, look for azip
package or similar.The
-e
flag specifies encryption is to be used on the zipfile; you'll be prompted for a password.The
-r
flag specifies recursion; all the files indir2
anddir4
will be included.The resulting zipped, encrypted file containing
dir2
anddir4
will be placed atfilename.zip
.