You could use a Create Archive action and rename the resulting archive:
d=${1%/*}
start="$d/${d##*/}"
name="$start.zip"
i=2
while [[ -e $name ]]; do
name="$start $i.zip"
let i++
done
mv "$1" "$name"
open -R "$name"
Or use a run shell shell script action like this:
for n in $(seq $(printf %s "$@" | tr -dc / | wc -c)); do
uniq=$(printf %s\\n "$@" | cut -d / -f1-$n | uniq)
[[ $uniq != *$'\n'* ]] && dir=$uniq || break
done
cd "${dir:-/}"
[[ $dir ]] && start=${dir##*/} || start=archive
name="$start.zip"
i=2
while [[ -e $name ]]; do
name="$start $i.zip"
let i++
done
zip -r "$name" -- "${@#$dir/}"
open -R "$name"
If some files have extended attributes or ACLs, zip removes them. Archive Utility and the Create Archive action store them in the AppleDouble format.