Skip to content

Instantly share code, notes, and snippets.

@zeekay
Created September 25, 2013 05:58
Show Gist options
  • Save zeekay/6695645 to your computer and use it in GitHub Desktop.
Save zeekay/6695645 to your computer and use it in GitHub Desktop.
Quickly cd to topmost Finder window.
function cdf {
pushd "`pwdf $@`";
}
function pwdf {
osascript -e 'tell application "Finder"'\
-e "if (${1-1} <= (count Finder windows)) then"\
-e "get POSIX path of (target of window ${1-1} as alias)"\
-e 'else' -e 'get POSIX path of (desktop as alias)'\
-e 'end if' -e 'end tell';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment