#!/bin/zsh local target_dir=$(dirname "${@: -1}") [[ ! -d "$target_dir" ]] && mkdir -p "$target_dir" exec mv "$@"