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 fi done
funda.sh In a directory were all of your archives are in, then execute it, and this is the output:
./finda.sh one.7z: Path = one/abradabra.png Path = one/birb.png three.rar: Path = three/blah.png Path = three/qwa0g.jpg two.zip: 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 'word-to-search' /path/to/test.gz
Zgrep invokes grep on compressed or gzipped files. All options speci‐ fied are passed directly to grep.