# cdf: cd to frontmost window of Finder
cdf ()
{
currFolderPath=$( /usr/bin/osascript <<" EOT"
tell application "Finder"
try
set currFolder to (folder of the front window as alias)
on error
set currFolder to (path to desktop folder as alias)
end try
POSIX path of currFolder
end tell
EOT
)
echo "cd to \"$currFolderPath\""
cd "$currFolderPath"
}
Created
January 6, 2015 14:09
-
-
Save andrewpmiller/5a0d4b434e9aba8be3a8 to your computer and use it in GitHub Desktop.
A clever alias for OSX that lets you cd to the the frontmost finder window. I found this while perusing Cameron Hayne's awesome bash aliases.
http://hayne.net/MacDev/Bash/aliases.bash
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment