cdp, cd to Current Path Finder Directory

Wednesday, July 03, 2013

Based on the similar command for OS X’s Finder by Brett Terpstra, use cdp to go to the current folder open in Path Finder and use p to open the current terminal directory in Path Finder.

# cd to the path of the front Path Finder window
cdp() {
    target=`osascript -e 'tell application "Path Finder" to if (count of windows) > 0 then get POSIX path of (target of front finder window)'`
    if [ "$target" != "" ]; then
        cd "$target"; pwd
        echo 'No Path Finder window found' >&2

# open Path Finder window in current directory
alias p='open -a Path\ Finder ./'