I want to get a list of all contents inside a (ZipCrypto) password protected zip archive inside the terminal.

Also, how can I filter/search specific file types using grep (Can I)?


You can encrypt files, but still leave the file list unencrypted. If thats the case, save the following code, as finda.sh, or any other name as you like:

for file in *.*; do
    if ( 7z l -slt "$file"> /tmp/$file.log); then
       echo $file:; cat /tmp/$file.log | grep -iE 'Path*'> $file.log && cat $file.log

Save funda.sh In a directory were all of your archives are in, then execute it, and this is the output:

Path = one/abradabra.png
Path = one/birb.png
Path = three/blah.png
Path = three/qwa0g.jpg
Path = two/whut.png

I don't think you can do this with encrypted compressed file.

But you can search for compressed files with no password using zgrep

 zgrep 'word-to-search' /path/to/test.gz

man zgrep

Zgrep invokes grep on compressed or gzipped files. All options speci‐ fied are passed directly to grep.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.