Need shell script for processing multiple files

I’m trying to get a list of .bsp files from a long list of .pk3 (.zip) files.

I can do that with one single file as in this example -

zipinfo filename.pk3 | grep .bsp

But sadly zipinfo doesn’t like using the wildcard for in_file_name.

I need to be able to do something like this in a bash script -

for each <filename.pk3>
  do
      zipinfo <filename> | grep .bsp >> maps.txt
  end

I have no idea how to do that though, any help appreciated :slight_smile:

for f in *.pk3
do
  zipinfo $f | grep '\.bsp'
done > maps.txt

Fantastic, thanks a million :smiley:

Actually even I forget this sometimes but you should write:

zipinfo “$f” …

just in case the filename contains whitespace.

Actually even I forget this sometimes but you should write:

zipinfo “$f” …

just in case the filename contains whitespace.

Use the find command. For example:

find . -name "*.pk3" -exec zipinfo -1 {} \;

NOTE: The space before the backslash semicolon is required.