Script to write all filenames inside a folder and its subfolders to a csv file

To search for .tif files inside a folder and its subfolders, then write the output in a .csv file you can use the following command:

find /path/to/folder -iname '*.tif' -type f >tif_filenames.csv

To search also inside .zip files and append the output to the previous tif_filenames.csv file you can use:

find /path/to/folder -iname '*.zip' -type f -exec unzip -l '{}' \; | process

where process is the following bash function:

function process() {
  while read line; do
    if [[ "$line" =~ ^Archive:\s*(.*) ]] ; then
      ar="${BASH_REMATCH[1]}"
    elif [[ "$line" =~ \s*([^ ]*\.tif)$ ]] ; then
      echo "${ar}: ${BASH_REMATCH[1]}"
    fi
  done
}

Source: https://unix.stackexchange.com/a/12048/37944