#!/usr/bin/env -S bash mapfile -t files <<< "$(ls -1 /tmp/kcw-*.zip)" for file in ${files[@]}; do echo "target: $file" dir=$(cut -d'$' -f1 <<< "$file") if ! [[ -d "$dir" ]]; then unzip -d "$dir" "$file" fi cmsImportTask "$dir" done