Eu encontrei uma solução. Foi catalisado pela pequena discussão de comentários que tive com @muru.
Por favor, leia atentamente os comentários no script bash abaixo.
#!/bin/bash
#''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#Checks within each .zip file in current folder
#for the presence of a .xyz or .abc file
#
#When a .xyz or .abc file is found, it extracts the latest version of it into
# ./xyzfiles or ./abcfiles AND renames these extracted .xyz or .abc files with
#the same name as the original zip file.
#
#Note that the xyzfiles and the abcfiles folder SHOULD BE FIRST CREATED!!
#
# Author: Anon
# Ver 2.0 / 7-Dec-2017
#
#''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
for i in *.zip;
do
xyz_exists=$(zipinfo $i | grep "xyz" | wc -l)
abc_exists=$(zipinfo $i | grep "abc" | wc -l)
if [ $xyz_exists != 0 ]
then
#echo true
path_to_file=($(zipinfo $i | grep "xyz" | awk '{print $9}'))
#echo $path_to_file
new_name_0=$i
#echo $new_name_0
new_name=$(echo "${new_name_0%.*}")
#echo $new_name
unzip -o -qq $i #Unzip while overwriting (-o), al done very quietly (-qq)
mv $path_to_file ./xyzfiles/$new_name
elif [ $abc_exists != 0 ]
then
#echo true
path_to_file=($(zipinfo $i | grep "abc" | awk '{print $9}'))
#echo $path_to_file
new_name_0=$i
#echo $new_name_0
new_name=$(echo "${new_name_0%.*}")
#echo $new_name
unzip -o -qq $i #Unzip while overwriting (-o), al done very quietly (-qq)
mv $path_to_file ./abcfiles/$new_name
fi
done
No momento, isso funciona bem. Pode haver problemas lógicos nos arquivos zip que estão sendo examinados ... Ainda não os encontrei.