osx service for `mpc add`ing files to mpd’s playlist
Following code …

for arg in "$@"; do
  dir=$(cd -P "$(dirname "$arg")" &amp;&amp; pwd)/ || continue
  /usr/local/bin/mpc add "${dir#"$HOME/Music/"}$(basename "$arg")"
done


does the trick.