Seems extremely simple, but I can't figure it out…
I want to be able to change to the directory (folder) where the dropped file is located before running my shell script on that file.
So either I change to the directory first with Automator, then pass that argument to Shell Script or Applescript
or I change to the directory inside of Applescript or Shell before running my Shell command. pls help
Best Answer
This is very easy in
zsh
. You can use the:h
option to a variable to refer to thehead
of its full path:In a shell like
bash
you would need to use thedirname
command: